select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SYSTEM CATALOGS / SYSTEM VIEWS

pg_prepared_statements

Read PG 18 manual ↗

The pg_prepared_statements view displays all the prepared statements that are available in the current session.

Kind
System views
Columns in this snapshot
8
Definition source
English manual

Columns 8

ColumnTypeDescription / reference
nametextThe identifier of the prepared statement
statementtextThe query string submitted by the client to create this prepared statement. For prepared statements created via SQL, this is the PREPARE statement submitted by the client. For prepared statements created via the frontend/backend protocol, this is the text of the prepared statement itself.
prepare_timetimestamptzThe time at which the prepared statement was created
parameter_typesregtype[]The expected parameter types for the prepared statement in the form of an array of regtype. The OID corresponding to an element of this array can be obtained by casting the regtype value to oid.
result_typesregtype[]The types of the columns returned by the prepared statement in the form of an array of regtype. The OID corresponding to an element of this array can be obtained by casting the regtype value to oid. If the prepared statement does not provide a result (e.g., a DML statement), then this field will be null.
from_sqlbooltrue if the prepared statement was created via the PREPARE SQL command; false if the statement was prepared via the frontend/backend protocol
generic_plansint8Number of times generic plan was chosen
custom_plansint8Number of times custom plan was chosen
Column history across versions
Version history 3
  1. PG 15 → 16changed
  2. PG 13 → 14changed
  3. PG 9.5 → 9.6changed

Definition snapshot: english-manuals:244a688a61d3393a3a7d9e6aa5c… · English manual source