Updated on 2024-05-07 GMT+08:00

GS_ALL_PREPARED_STATEMENTS

GS_ALL_PREPARED_STATEMENTS displays information about prepared statements that are available in all sessions. Only the system administrator can access this view.

Table 1 GS_ALL_PREPARED_STATEMENTS columns

Name

Type

Description

pid

bigint

Backend thread ID.

NOTE:

In thread pool mode, pid indicates the ID of the thread bound to the current session. When a session is executed on different threads, pid changes accordingly. In thread pool mode, statements are associated with sessionid but not pid. You are advised to use sessionid for associated query.

sessionid

bigint

Current session ID.

global_sessionid

text

Global session ID.

name

text

Identifier of the prepared statement.

statement

text

Query string for creating this prepared statement. For prepared statements created through SQL, this is the PREPARE statement submitted by the client. For prepared statements created through the frontend/backend protocol, this is the text of the prepared statement itself.

prepare_time

timestamp with time zone

Timestamp when the prepared statement is created.

parameter_types

regtype[]

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 converting the regtype value to an OID value.

from_sql

boolean

  • Its value is true if the prepared statement was created through the PREPARE statement
  • Its value is false if the statement was prepared through the frontend/backend protocol