Updated on 2024-06-03 GMT+08:00

PLAN_TABLE_DATA

PLAN_TABLE_DATA stores plan information collected by EXPLAIN PLAN. Different from the PLAN_TABLE view, the system catalog PLAN_TABLE_DATA stores EXPLAIN PLAN information collected by all sessions and users.

Table 1 PLAN_TABLE_DATA columns

Name

Type

Description

session_id

text

Session that inserts the data. Its value consists of a service thread start timestamp and a service thread ID. Values are constrained by NOT NULL.

user_id

oid

User who inserts the data. Values are constrained by NOT NULL.

statement_id

character varying(30)

Query tag specified by a user

plan_id

bigint

Query plan ID. The ID is automatically generated in the plan generation phase and is used by kernel engineers for debugging.

id

integer

Node ID in a plan.

operation

character varying(30)

Operation description.

options

character varying(255)

Operation action.

object_name

name

Name of an operated object. It is defined by users.

object_type

character varying(30)

Object type.

object_owner

name

Schema to which an object belongs. It is defined by users.

projection

character varying(4000)

Returned column information.

cost

double precision

Execution cost estimated by the optimizer for an operator.

cardinality

double precision

Number of rows estimated by the optimizer for an operator.

  • PLAN_TABLE_DATA records data of all users and sessions on the current node. Only administrators can access all the data. Common users can view their own data in the PLAN_TABLE view.
  • Data of inactive (exited) sessions is cleaned from PLAN_TABLE_DATA by gs_clean after being stored in this system catalog for a certain period of time (5 minutes by default). You can also manually run gs_clean -C to delete inactive session data from the table.
  • Data is automatically inserted into PLAN_TABLE_DATA after EXPLAIN PLAN is executed. Therefore, do not manually insert data into or update data in PLAN_TABLE_DATA. Otherwise, data in PLAN_TABLE_DATA may be disordered. When you need to delete data from a table, it is recommended that you use the PLAN_TABLE view.
  • Information in the statement_id, object_name, object_owner, and projection columns is stored in letter cases specified by users and information in other columns is stored in uppercase.