(no version information, might be only in CVS)pg_send_prepare -- Asynchronously prepares a query for future execution
pg_send_prepare() asynchronously prepares a query on the connection. Unlike pg_prepare(), script execution is not blocked while the query is being prepared. It behaves in the same fashion as pg_send_query().
Parameters to pg_prepare() are specified using placeholders in the query. It is not necessary to quote parameters as quoting and escaping is done automatically. Placeholders are indicated in the query by $1, $2, $3 and so on.
Using prepared queries means you can prepare one and then execute many times, with different parameters. PostgreSQL will cache the query plan on the prepare, then re-use it for each execute, resulting in speed improvements. There is no need to use a prepared query if it will only be executed once. In this case, it is simpler to use pg_query_params().
Exemple 1. Using pg_send_prepare()