The PostgreSQL Prepared Statement or Parameterized Statements are always good for specific purpose like: can create Prepared Statement for frequently executing query of a session, It also prevents from SQL Injections.
Prepared Statements are faster for a particular session because It does not require parsing and compiling for each execution. It is only session specific and once a session kill, Prepared Statements automatically destroy.
Here, You can access more on Prepared Statements.
Small demonstration of PostgreSQL Prepared Statement:
Create a table with sample records:
CREATE TABLE tbl_Students
StudID INTEGER PRIMARY KEY
,StudName CHARACTER VARYING
INSERT INTO tbl_Students
Create a Prepared Statement to SELECT Students data:
PREPARE pre_GetStudents (INT) AS
SELECT *FROM tbl_Students WHERE StudID = $1;
Execute a Prepared Statement:
System view to check the Prepare statements of session:
SELECT *FROM pg_prepared_statements;