Updated on 2024-08-20 GMT+08:00

GS_ALL_PREPARED_STATEMENTS

GS_ALL_PREPARED_STATEMENTS displays information about prepared statements that are available in all sessions. This view is accessible only to system administrators.

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 join query.

sessionid

bigint

Current session ID.

global_sessionid

text

Global session ID.

name

text

Prepared statement identifier.

statement

text

Query string for creating this prepared statement.

  • The column is the PREPARE statements committed by the client for prepared statements created from SQL.
  • The column is the text of the prepared statements for prepared statements created through a front-end/back-end protocol.

prepare_time

timestamp with time zone

Timestamp when the prepared statement is created.

parameter_types

regtype[]

Expected parameter type of the prepared statement in the form of a regtype array. The OID corresponding to this array can be obtained by converting the regtype value.

from_sql

boolean

  • True if the prepared statement was created through the PREPARE statement.
  • False if the statement was prepared through the frontend/backend protocol.