A prepared statement is a valuable technique that rejects SQL injection into your applications as well as allows you to bypass regular query parsing in order to save overhead. You might use one like the following:
PREPARE getvals (int) AS SELECT * FROM t WHERE t.v=$1; EXECUTE getvals(5);
This returns everything in the rows with a matching v value. The PREPARE saves the output from the query parsing and planning stage. You might think that this will always be a win over directly executing the query if it's being executed more than once, because that overhead will then be amortized over more statements.
This isn't necessarily true. When a statement is prepared, the query optimizer can only produce ...