Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add 1st batch of system table docs #77

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
40 changes: 40 additions & 0 deletions docs/sys-catalogs/sys-table-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

[`gp_configuration_history`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-configuration-history.md)

[`gp_distribution_policy`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-distribution-policy.md)

[`gp_fastsequence`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-fastsequence.md)

[`gp_id`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-id.md)

[`gp_partition_template`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-partition-template.md)

[`gp_segment_configuration`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-segment-configuration.md)

[`gp_version_at_initdb`](/docs/sys-catalogs/sys-tables/sys-tbl-gp-version-at-initdb.md)

[`pg_aggregate`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-aggregate.md)

[`pg_am`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-am.md)

[`pg_amop`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-amop.md)

[`pg_amproc`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-amproc.md)

[`pg_appendonly`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-appendonly.md)

[`pg_attribute_encoding`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-attribute-encoding.md)

[`pg_attribute`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-attribute.md)

[`pg_attridef`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-attridef.md)

[`pg_auth_members`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-auth-members.md)

[`pg_authid`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-authid.md)

[`pg_cast`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-cast.md)

[`pg_class`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-class.md)

[`pg_constraint`](/docs/sys-catalogs/sys-tables/sys-tbl-pg-constraint.md)
17 changes: 17 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-configuration-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: gp_configuration_history
---

# gp_configuration_history

The `gp_configuration_history` table in the `pg_catalog` schema contains information about system changes related to fault detection and recovery operations. The `fts_probe` process logs data to this table, as do certain related management utilities such as `gprecoverseg` and `gpinitsystem`. For example, when you add a new segment and mirror segment to the system, records for these events are logged to `gp_configuration_history`.

The event descriptions stored in this table may be helpful for troubleshooting serious system issues in collaboration with VMware Support technicians.

This table is populated only on the coordinator. This table is defined in the `pg_global` tablespace, meaning it is globally shared across all databases in the system.

|column|type|references|description|
|------|----|----------|-----------|
|`time`|timestamp with time zone| |Timestamp for the event recorded.|
|`dbid`|smallint| `gp_segment_configuration.dbid` |System-assigned ID. The unique identifier of a segment (or coordinator) instance.|
| `desc` |text| |Text description of the event.|
16 changes: 16 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-distribution-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: gp_distribution_policy
---

# gp_distribution_policy

The `gp_distribution_policy` table in the `pg_catalog` schema contains information about Greenplum Database tables and their policy for distributing table data across the segments. This table is populated only on the coordinator. This table is not globally shared, meaning each database has its own copy of this table.

|column|type|references|description|
|------|----|----------|-----------|
|`localoid`|oid| `pg_class.oid` |The table object identifier (OID).|
|`policytype`|char| |The table distribution policy:<br/><br/>`p` - Partitioned policy. Table data is distributed among segment instances.<br/><br/>`r` - Replicated policy. Table data is replicated on each segment instance.|
|`numsegments`|integer| |The number of segment instances on which the table data is distributed.|
|`distkey`|int2vector| `pg_attribute.attnum` |The column number(s) of the distribution column(s).|
|`distclass`|oidvector|`pg_opclass.oid`|The operator class identifier(s) of the distribution column(s).|

13 changes: 13 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-fastsequence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: gp_fastsequence
---

# gp_fastsequence

The `gp_fastsequence` table in the `pg_catalog` schema contains information about append-optimized and column-oriented tables. The `last_sequence` value indicates maximum row number currently used by the table.

|column|type|references|description|
|------|----|----------|-----------|
|`objid`|oid| `pg_class.oid` |Object id of the `pg_aoseg.pg_aocsseg_*` table used to track append-optimized file segments.|
|`objmod`|bigint| |Object modifier.|
|`last_sequence`|bigint| |The last sequence number used by the object.|
14 changes: 14 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: gp_id
---

# gp_id

The `gp_id` system catalog table in the `pg_catalog` schema identifies the Cloudberry Database system name and number of segments for the system. It also has `local` values for the particular database instance (segment or coordinator) on which the table resides. This table is defined in the `pg_global` tablespace, meaning it is globally shared across all databases in the system.

|column|type|references|description|
|------|----|----------|-----------|
|`gpname`|name| |The name of this Cloudberry Database system.|
|`numsegments`|smallint| |The number of segments in the Cloudberry Database system.|
|`dbid`|smallint| |The unique identifier of this segment (or coordinator) instance.|
|`content`|smallint| |The ID for the portion of data on this segment instance. A primary and its mirror will have the same content ID.<br/><br/>For a segment the value is from 0-*N-1*, where *N* is the number of segments in Cloudberry Database.<br/><br/>For the coordinator, the value is -1.|
19 changes: 19 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-partition-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: gp_partition_template
---

# gp_partition_template

The `gp_partition_template` system catalog table in the `pg_catalog` schema describes the relationship between a partitioned table and the sub-partition template defined at each level in the partition hierarchy.

:::info
Cloudberry Database supports sub-partition templates only for partitioned tables that you create with the classic syntax.
:::

Each sub-partition template has a dependency on the existence of a template at the next lower level of the hierarchy.

|column|type|references|description|
|------|----|----------|-----------|
|`relid`| oid | `pg_class.oid` | The object identifier of the root partitioned table. |
|`level`|smallint| | The level of the partition in the hierarchy. The levels are numbered as follows: level `0` is the root partitioned table itself, level `1` represents the direct child/children of the root partitioned table, and so forth. The leaf partitions have the highest level number.|
|`template`| `pg_node_tree` | | Expression representation of the sub-partition template defined for each partition at this level of the hierarchy. |
20 changes: 20 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-segment-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: gp_segment_configuration
---

# gp_segment_configuration

The `gp_segment_configuration` table in the `pg_catalog` schema contains information about mirroring and segment instance configuration.

|column|type|references|description|
|------|----|----------|-----------|
|`dbid`|smallint| |Unique identifier of a segment (or coordinator) instance.|
|`content`|smallint| |The content identifier for a segment instance. A primary segment instance and its corresponding mirror will always have the same content identifier.<br/><br/>For a segment the value is from 0 to *N*-1, where *N* is the number of primary segments in the system.<br/><br/>For the coordinator, the value is always -1.|
|`role`|char| |The role that a segment is currently running as. Values are `p` (primary) or `m` (mirror).|
|`preferred_role`|char| |The role that a segment was originally assigned at initialization time. Values are `p` (primary) or `m` (mirror).|
|`mode`|char| |The synchronization status of a segment instance with its mirror copy. Values are `s` (Synchronized) or `n` (Not In Sync).<br/><br/> This column always shows `n` for the coordinator segment and `s` for the standby coordinator segment, but these values do not describe the synchronization state for the coordinator segment. Use `gp_stat_replication` to determine the synchronization state between the coordinator and standby coordinator.|
|`status`|char| |The fault status of a segment instance. Values are `u` (up) or `d` (down).|
|`port`|integer| |The TCP port the database server listener process is using.|
|`hostname`|text| |The hostname of a segment host.|
|`address`|text| |The hostname used to access a particular segment instance on a segment host. This value may be the same as `hostname` on systems that do not have per-interface hostnames configured.|
|`datadir`|text| |Segment instance data directory.|
12 changes: 12 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-gp-version-at-initdb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: gp_version_at_initdb
---

# gp_version_at_initdb

The `gp_version_at_initdb` table in the `pg_catalog` schema is populated on the coordinator and each segment in the Cloudberry Database system. It identifies the version of Cloudberry Database used when the system was first initialized. This table is defined in the `pg_global` tablespace, meaning it is globally shared across all databases in the system.

|column|type|references|description|
|------|----|----------|-----------|
|`schemaversion`|smallint| |Schema version number.|
|`productversion`|text| |Product version number.|
32 changes: 32 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-pg-aggregate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: pg_aggregate
---

# pg_aggregate

The `pg_aggregate` table in the `pg_catalog` schema stores information about aggregate functions. An aggregate function is a function that operates on a set of values (typically one column from each row that matches a query condition) and returns a single value computed from all these values. Typical aggregate functions are `sum`, `count`, and `max`. Each entry in `pg_aggregate` is an extension of an entry in `pg_proc`. The `pg_proc` entry carries the aggregate's name, input and output data types, and other information that is similar to ordinary functions.

|column|type|references|description|
|------|----|----------|-----------|
|`aggfnoid`|regproc|`pg_proc.oid`|OID of the aggregate function|
|`aggkind`|char| |Aggregate kind: `n` for *normal* aggregates, `o` for *ordered-set* aggregates, or `h` for *hypothetical-set* aggregates|
|`aggnumdirectargs`|smallint| |Number of direct (non-aggregated) arguments of an ordered-set or hypothetical-set aggregate, counting a variadic array as one argument. If equal to `pronargs`, the aggregate must be variadic and the variadic array describes the aggregated arguments as well as the final direct arguments. Always zero for normal aggregates.|
|`aggtransfn`|regproc|`pg_proc.oid`|Transition function OID|
|`aggfinalfn`|regproc|`pg_proc.oid`|Final function OID (zero if none)|
|`aggcombinefn`|regproc|`pg_proc.oid`|Combine function OID (zero if none)|
|`aggserialfn`|regproc|`pg_proc.oid`|OID of the serialization function to convert transtype to `bytea` (zero if none)|
|`aggdeserialfn`|regproc|`pg_proc.oid`|OID of the deserialization function to convert `bytea` to transtype (zero if none)|
|`aggmtransfn`|regproc|`pg_proc.oid`|Forward transition function OID for moving-aggregate mode (zero if none)|
|`aggminvtransfn`|regproc|`pg_proc.oid`|Inverse transition function OID for moving-aggregate mode (zero if none)|
|`aggmfinalfn`|regproc|`pg_proc.oid`|Final function OID for moving-aggregate mode (zero if none)|
|`aggfinalextra`|bool| |True to pass extra dummy arguments to `aggfinalfn`|
|`aggmfinalextra`|bool| |True to pass extra dummy arguments to `aggmfinalfn`|
|`aggfinalmodify`|char| |Indicates whether `aggfinalfn` modifies the transition state|
|`aggmfinalmodify`|char| |Indicates whether `aggmfinalfn` modifies the transition state|
|`aggsortop`|oid|`pg_operator.oid`|Associated sort operator OID (zero if none)|
|`aggtranstype`|oid|`pg_type.oid`|Data type of the aggregate function's internal transition (state) data|
|`aggtransspace`|integer| |Approximate average size (in bytes) of the transition state data, or zero to use a default estimate|
|`aggmtranstype`|oid|`pg_type.oid`|Data type of the aggregate function's internal transition (state) data for moving-aggregate mode (zero if none)|
|`aggmtransspace`|integer| |Approximate average size (in bytes) of the transition state data for moving-aggregate mode, or zero to use a default estimate|
|`agginitval`|text| |The initial value of the transition state. This is a text field containing the initial value in its external string representation. If this field is NULL, the transition state value starts out NULL.|
|`aggminitval`|text| |The initial value of the transition state for moving- aggregate mode. This is a text field containing the initial value in its external string representation. If this field is NULL, the transition state value starts out NULL.|
14 changes: 14 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-pg-am.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: pg_am
---

# pg_am

The `pg_am` table in the `pg_catalog` schema stores information about index access methods. There is one row for each index access method supported by the system.

|column|type|references|description|
|------|----|----------|-----------|
|`oid`|oid| |Row identifier (hidden attribute; must be explicitly selected)|
|`amname`|name| |Name of the access method|
|`amhandler`|regproc| | OID of a handler function responsible for supplying information about the access method|
|`amtype`|char| |`t` for table (including materialized views), `i` for index|
21 changes: 21 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-pg-amop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: pg_amop
---

# pg_amop

The `pg_amop` table in the `pg_catalog` schema stores information about operators associated with index access method operator classes. There is one row for each operator that is a member of an operator class.

An entry's `amopmethod` must match the `opfmethod` of its containing operator family (including `amopmethod` here is an intentional denormalization of the catalog structure for performance reasons). Also, `amoplefttype` and `amoprighttype` must match the `oprleft` and `oprright` fields of the referenced `pg_operator` entry.

|column|type|references|description|
|------|----|----------|-----------|
|`oid`|oid| |Row identifier (hidden attribute; must be explicitly selected)|
|`amopfamily`|oid| `pg_opfamily.oid` |The operator family that this entry is for|
|`amoplefttype`|oid|`pg_type.oid`|Left-hand input data type of operator|
|`amoprighttype`|oid|`pg_type.oid`|Right-hand input data type of operator|
|`amopstrategy`|smallint| |Operator strategy number|
|`amoppurpose`|char| |Operator purpose, either `s` for search or `o` for ordering|
|`amopopr`|oid|`pg_operator.oid`|OID of the operator|
|`amopmethod`|oid|`pg_am.oid`|Index access method for the operator family|
|`amopsortfamily`|oid|`pg_opfamily.oid`|If an ordering operator, the B-tree operator family that this entry sorts according to; zero if a search operator|
16 changes: 16 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-pg-amproc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: pg_amproc
---

# pg_amproc

The `pg_amproc` table in the `pg_catalog` schema stores information about support procedures associated with index access method operator classes. There is one row for each support procedure belonging to an operator class.

|column|type|references|description|
|------|----|----------|-----------|
|`oid`|oid| |Row identifier (hidden attribute; must be explicitly selected)|
|`amprocfamily`|oid|`pg_opfamily.oid`|The operator family this entry is for|
|`amproclefttype`|oid|`pg_type.oid`|Left-hand input data type of associated operator|
|`amprocrighttype`|oid|`pg_type.oid`|Right-hand input data type of associated operator|
|`amprocnum`|smallint| |Support procedure number|
|`amproc`|regproc|`pg_proc.oid`|OID of the procedure|
23 changes: 23 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-pg-appendonly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: pg_appendonly
---

# pg_appendonly

The `pg_appendonly` table in the `pg_catalog` schema contains information about the storage options and other characteristics of append-optimized tables.

|column|type|references|description|
|------|----|----------|-----------|
|`relid`|oid| |The table object identifier \(OID\) of the table.|
| `blocksize` | integer | | Block size used for compression of append-optimized tables. Valid values are 8K - 2M. Default is `32K`. |
| `safefswritesize` | integer| | Minimum size for safe write operations to append-optimized tables in a non-mature file system. Commonly set to a multiple of the extent size of the file system; for example, Linux ext3 is `4096` bytes, so a value of `32768` is commonly used. |
| `compresslevel`|smallint| |The compression level, with compression ratio increasing from 1 to 19. When quicklz1 is specified for compresstype, valid values are 1 or 3. With zlib specified, valid values are 1-9. When zstd is specified, valid values are 1-19. |
| `checksum`|boolean| |A checksum value that is stored to compare the state of a block of data at compression time and at scan time to ensure data integrity. |
| `compresstype`|text| |Type of compression used to compress append-optimized tables. Valid values are: <br /> - `none` (no compression)<br /> - `rle_type` (run-length encoding compression) <br />- `zlib` (gzip compression) <br />- `zstd` (Zstandard compression)<br /> - `quicklz` |
| `columnstore` | boolean | | `1` for column-oriented storage, `0` for row-oriented storage. |
| `segrelid` | oid | |Table on-disk segment file id. |
| `segfilecount` | smallint| |Number of segment files. |
| `blkdirrelid` | oid | |Block used for on-disk column-oriented table file. |
| `blkdiridxid` | oid | |Block used for on-disk column-oriented index file. |
| `visimaprelid` | oid | |Visibility map for the table. |
| `visimapidxid` | oid | |B-tree index on the visibility map. |
19 changes: 19 additions & 0 deletions docs/sys-catalogs/sys-tables/sys-tbl-pg-attribute-encoding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: pg_attribute_encoding
---

# pg_attribute_encoding

The `pg_attribute_encoding` system catalog table in the `pg_catalog` schema contains column storage information.

|column|type|modifers|storage|description|
|------|----|--------|-------|-----------|
|`attrelid`|oid|not null|plain|Foreign key to `pg_attribute.attrelid`|
|`attnum`|smallint|not null|plain|Foreign key to `pg_attribute.attnum`|
|`attoptions`|text [ ]| |extended|The options|

For a column with `filenum = f`, the column files on disk use the suffix `(f - 1)*128 to f*128 - 1`. For example:

- Column with `filenum = 1` has files `relfilenode`, `relfilenode.1` .. `relfilenode.127`.
- Column with `filenum = 2` has files `relfilenode.128`, `relfilenode.129` .. `relfilenode.255`.
- Column with `filenum = 3` has files `relfilenode.256`, `relfilenode.257` .. `relfilenode.383`.
Loading