Skip to content
← Catalog atlas / pg_prepared_statements

SYSTEM VIEW · System view

pg_prepared_statements

The pg_prepared_statements view displays all the prepared statements that are available in the current session. See PREPARE for more information about prepared statements. pg_prepared_statements contains one row for each prepared statement. Rows are added to the view when a new prepared statement is created and removed when a prepared statement is released (for example, via the DEALLOCATE command).

First seen PG 9.0Last seen PG 19Columns 8

Checked column by column against a PostgreSQL 18.6 instance · Raw measurement record ↗

Columns PostgreSQL 18

pg_prepared_statements
COLUMNTYPEDESCRIPTION
name text The identifier of the prepared statement
statement text The 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_time timestamp with time zoneDocumented as:timestamptz The time at which the prepared statement was created
parameter_types regtype[] 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_types regtype[] 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_sql booleanDocumented as:bool true if the prepared statement was created via the PREPARE SQL command; false if the statement was prepared via the frontend/backend protocol
generic_plans bigintDocumented as:int8 Number of times generic plan was chosen
custom_plans bigintDocumented as:int8 Number of times custom plan was chosen

Columns marked "implicit" are not included in SELECT *; some early statistics views are completed from same-version source, and the extra provenance is shown in the column description.

Column evolution matrix

Hover a cell for the column type
PresentAdded / type or attribute changeRemoved
COLUMN9.09.19.29.39.49.59.610111213141516171819
name
statement
prepare_time
parameter_types
from_sql
generic_plans
custom_plans
result_types

9.0 is the coverage baseline; a column already present in the baseline is not marked as added. The matrix aligns columns by name, so a rename appears as the old column removed and a new column added.

Evolution timeline

Changes between adjacent majors

PostgreSQL 16 ← 15

+ result_types

PostgreSQL 14 ← 13

+ generic_plans+ custom_plans

PostgreSQL 9.6 ← 9.5

1 column description updates

Compare any two versions

Pick two versions to see added, removed, and retyped columns. The interactive comparison needs JavaScript; the evolution timeline reads fine without it.