# pg_class

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: pg_class
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/system-catalogs/catalogs/pg_class
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/system-catalogs/catalogs/pg_class.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/system-catalogs/catalogs/pg_class.adoc
description: The pg_class stores information about tables and indexes in the database.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/system-catalogs/catalogs/pg_class.md -->

The `pg_class` stores information about tables and indexes in the database. It contains exactly one row per table (or index) created in the database. It mimics the [pg\_class](https://www.postgresql.org/docs/current/catalog-pg-class.html) PostgreSQL system catalog.

## [](#columns)Columns

The following columns are available for querying in `pg_class`:

| Column | Type | Description |
| --- | --- | --- |
| oid | int | This column represents the table/index object ID (OID) that Redpanda SQL generates. |
| relname | text | This column represents the table/index name as specified by the user during creation |
| relnamespace | int | This column represents the OID of the namespace the relation resides in |
| relhasindex | bool | Returns true if the table has any indexes |
| relkind | text | This column represents the type of relation: r for tables and i for indexes |
| reltype | int | Unused |
| reloftype | int | Unused |
| relowner | int | Unused |
| relam | int | Unused |
| relfilenode | int | Unused |
| reltablespace | int | Unused |
| relpages | int | Unused |
| reltuples | float | Unused |
| relallvisible | int | Unused |
| reltoastrelid | int | Unused |
| relisshared | bool | Unused |
| relpersistence | text | Unused |
| relnatts | int | Unused |
| relchecks | int | Unused |
| relhasrules | bool | Unused |
| relhastriggers | bool | Unused |
| relhassubclass | bool | Unused |
| relrowsecurity | bool | Unused |
| relforcerowsecurity | bool | Unused |
| relispopulated | bool | Unused |
| relreplident | text | Unused |
| relispartition | bool | Unused |
| relrewrite | int | Unused |
| relfrozenxid | int | Unused |
| relacl | text | Unused |
| reloptions | text | Unused |
| relminmxid | text | Unused |
| relpartbound | text | Unused |

## [](#examples)Examples

1.  Create a table and define its schema:

    ```sql
    CREATE TABLE customer_orders (
        order_id INT,
        customer_id INT,
        order_date DATE,
        total_amount INT
    );
    ```

2.  Create an index on the `customer_orders` table for the `customer_id` column:

    ```sql
    CREATE INDEX idx_customer_id ON customer_orders (customer_id);
    ```

3.  Query the `pg_class` catalog to retrieve information about the `customer_orders` table and the index you’ve just created:

    ```sql
    SELECT oid, relname, relkind, relhasindex, relnamespace
    FROM pg_class
    WHERE relname IN ('customer_orders', 'idx_customer_id');
    ```

4.  The query returns information about the `customer_orders` table and the index:

    ```sql
     oid  |     relname     | relkind | relhasindex | relnamespace
    ------+-----------------+---------+-------------+--------------
     1013 | idx_customer_id | i       | f           |            0
     1012 | customer_orders | r       | t           |            0
    (2 rows)
    ```