Parsing, Planning and Optimizing Prepared Statements PostgreSQL (2nd Edition) by Douglas and Douglas notes:


  Use server-side procedures (triggers and functions) to perform common operations. A server-side procedure is parsed, planned and optimized the first you use it, not every time you use it.


When using a prepared statement, is it parsed, planned and optimized only on the first time it's used (similar to triggers and functions per the quoted text), or each time it's used?
The PostgreSQL doc for PREPARE is clear about the advantages of prepared statements in terms of performance:


  PREPARE creates a prepared statement. A prepared statement is a
  server-side object that can be used to optimize performance. When the
  PREPARE statement is executed, the specified statement is parsed,
  analyzed, and rewritten. When an EXECUTE command is subsequently
  issued, the prepared statement is planned and executed. This division
  of labor avoids repetitive parse analysis work, while allowing the
  execution plan to depend on the specific parameter values supplied.