52.77. pg\_prepared\_statements

|52.77. `pg_prepared_statements`|                   |                           |                  |                                    |
|:-----------------------------:|-------------------|---------------------------|------------------|------------------------------------|
| [Prev](view-pg-policies.html) |[Up](catalogs.html)|Chapter 52. System Catalogs|[Home](index.html)| [Next](view-pg-prepared-xacts.html)|

---

## 52.77. `pg_prepared_statements`

[]()

 The `pg_prepared_statements` view displays all the prepared statements that are available in the current session. See [PREPARE](sql-prepare.html) 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`](sql-deallocate.html) command).

**Table 52.78. `pg_prepared_statements` Columns**

|                                                                                                                                                Column Type<br/><br/> Description                                                                                                                                               |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|                                                                                                                                `name` `text`<br/><br/> The identifier of the prepared statement                                                                                                                                |
|`statement` `text`<br/><br/> 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` `timestamptz`<br/><br/> The time at which the prepared statement was created                                                                                                                   |
|                                        `parameter_types` `regtype[]`<br/><br/> 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`.                                        |
|                                                                         `from_sql` `bool`<br/><br/>`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` `int8`<br/><br/> Number of times generic plan was chosen                                                                                                                            |
|                                                                                                                             `custom_plans` `int8`<br/><br/> Number of times custom plan was chosen                                                                                                                             |

 The `pg_prepared_statements` view is read-only.

---

|[Prev](view-pg-policies.html)|[Up](catalogs.html)| [Next](view-pg-prepared-xacts.html)|
|:----------------------------|:-----------------:|-----------------------------------:|
|    52.76. `pg_policies`     |[Home](index.html) |     52.78. `pg_prepared_xacts`     |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>