Updated on 2025-07-15 GMT+08:00

GV_SESSION

GV_SESSION view describes the information related to the current user's queries. The columns save information about the last query.

Table 1 GV_SESSION columns

Name

Type

Description

sid

bigint

Session ID.

serial#

integer

Sequence number of the active backend thread, which is 0 in GaussDB.

schemaname

name

Name of the user logged in to the backend.

user#

oid

OID of the user who has logged in to the backend thread. Its value is 0 if the backend thread is a global auxiliary thread.

username

name

Name of the user logged in to the backend thread. username is null if the backend thread is a global auxiliary thread.

machine

text

Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This column will be non-null only for IP connections and only when log_hostname is enabled.

sql_id

bigint

ID of a query.

client_info

text

Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This column will be non-null only for IP connections and only when log_hostname is enabled.

event

text

Queuing status of a statement. Its value can be:

  • waiting in queue: The statement is in the queue.
  • Empty: The statement is running.

sql_exec_start

timestamp with time zone

Time when the currently active query was started, or if state is not active, when the last query was started.

program

text

Name of the application connected to the backend.

status

text

Overall status of this backend. Its value can be:

  • active: The backend is executing a query.
  • idle: The backend is waiting for a new client command.
  • idle in transaction: The backend is in a transaction, but there is no statement being executed in the transaction.
  • idle in transaction (aborted): The backend is in a transaction, but there are statements failed in the transaction.
  • fastpath function call: The backend is executing a fast-path function.
  • disabled: This state is reported if track_activities is disabled in this backend.