---
title: "SHOW statements"
description: "Inspect a CoraDB database with SHOW statements: SHOW TABLES, COLUMNS, INDEX, CREATE TABLE, GRANTS, statistics and diagnostics."
url: "https://www.coradb.ai/manual/sql/query/show.html"
markdown_url: "https://www.coradb.ai/manual/markdown/sql/query/show.md"
product: "CoraDB"
version: "1.0"
keywords: "show statement, show tables, show full tables, show columns, describe, desc, show index, show create table, show create view, show grants, show collation, show timezones, show access status, show exec statistics, show transaction tables, show threads, coradb show"
---

# SHOW statements

**SHOW** statements return information about the database itself: its tables and their columns, indexes and definitions, user permissions, the supported collations and time zones, and, for administrators, the internal state of the server. Their results are ordinary result sets, so most of them accept `LIKE` or `WHERE` to filter the rows.

> **Try it yourself:**
> The examples run on the [e-commerce sample database](https://www.coradb.ai/manual/sample-database.html) and show the real results. Connect with `corasql -u dba e-commerce`. For statements that return many columns, switch corasql to one-column-per-line output with the `;line on` session command.


## SHOW TABLES

Lists the tables of the current database.

```text
SHOW [FULL] TABLES [LIKE 'pattern' | WHERE expr]
```

- The result column is named `Tables_in_<database name>`.
- **FULL** adds a `Table_type` column: `BASE TABLE` for a relational table, `VERTEX TABLE` and `EDGE TABLE` for graph tables, and `VIEW` for a view.
- **LIKE** filters on the table name; **WHERE** can use both columns.

```sql
SHOW FULL TABLES LIKE '%o%';
```

| Tables_in_e-commerce | Table_type |
|---|---|
| category | VERTEX TABLE |
| countries | BASE TABLE |
| customer | VERTEX TABLE |
| follows | EDGE TABLE |
| located_at | EDGE TABLE |
| located_in | EDGE TABLE |
| order_items | BASE TABLE |
| orders | BASE TABLE |
| part_of | EDGE TABLE |
| product | VERTEX TABLE |

List only the vertex tables:

```sql
SHOW FULL TABLES WHERE table_type = 'VERTEX TABLE';
```

| Tables_in_e-commerce | Table_type |
|---|---|
| brand | VERTEX TABLE |
| category | VERTEX TABLE |
| city | VERTEX TABLE |
| customer | VERTEX TABLE |
| product | VERTEX TABLE |
| supplier | VERTEX TABLE |

The database name `e-commerce` contains a hyphen, so the name column must be written in brackets when you use it in `WHERE`:

```sql
SHOW FULL TABLES
WHERE table_type = 'BASE TABLE' AND [Tables_in_e-commerce] LIKE 'order%';
```

| Tables_in_e-commerce | Table_type |
|---|---|
| order_items | BASE TABLE |
| orders | BASE TABLE |


## SHOW COLUMNS, DESCRIBE

Lists the columns of a table or view.

```text
SHOW [FULL] {COLUMNS | FIELDS} {FROM | IN} table_name [LIKE 'pattern' | WHERE expr]
{DESCRIBE | DESC | EXPLAIN} table_name
```

`SHOW FIELDS` is a synonym of `SHOW COLUMNS`. `DESCRIBE`, its short form `DESC` and `EXPLAIN` *table_name* return the same columns as `SHOW COLUMNS`, without the `LIKE` and `WHERE` options.

| Column | Description |
|---|---|
| Field | Column name. |
| Type | Data type. |
| Collation | Collation of a character column (with `FULL` only). |
| Null | `YES` if the column accepts `NULL`, `NO` otherwise. |
| Key | `PRI` if the column is (part of) the primary key, `UNI` if it is the first column of a unique index, `MUL` if it is the first column of a non-unique index; empty otherwise. When several apply, the first in this order is shown. |
| Default | Default value of the column. |
| Extra | Additional information, such as `auto_increment`. |
| Comment | Column comment (with `FULL` only). |

```sql
SHOW COLUMNS FROM orders;
```

| Field | Type | Null | Key | Default | Extra |
|---|---|---|---|---|---|
| id | INTEGER | NO | PRI | NULL |  |
| customer_id | INTEGER | NO | MUL | NULL |  |
| shipped_date | DATE | YES | MUL | NULL |  |
| shipping_cost | NUMERIC(10,2) | NO |  | NULL |  |
| ship_address | VARCHAR(128) | NO |  | NULL |  |
| order_date | DATE | NO | MUL | NULL |  |

```sql
DESC countries;
```

| Field | Type | Null | Key | Default | Extra |
|---|---|---|---|---|---|
| code | VARCHAR(8) | NO | PRI | NULL |  |
| name | VARCHAR(32) | NO |  | NULL |  |


## SHOW INDEX

Lists the indexes of a table, one row per indexed column.

```text
SHOW {INDEX | INDEXES | KEYS} {FROM | IN} table_name
```

| Column | Description |
|---|---|
| Table | Table name. |
| Non_unique | 0 if the index cannot contain duplicate values, 1 if it can. |
| Key_name | Index name. |
| Seq_in_index | Position of the column in the index, starting at 1. |
| Column_name | Column name. |
| Collation | Sort order of the column in the index: `A` (ascending), `D` (descending) or `NULL`. |
| Cardinality | Approximate number of distinct values in the index. The higher it is, the more selective the index. |
| Sub_part | Number of characters indexed when only a prefix of the column is indexed, as in `CREATE INDEX ... (name(7))`; `NULL` when the whole column is indexed. |
| Packed | How the key is packed; always `NULL`. |
| Null | `YES` if the column accepts `NULL`, `NO` otherwise. |
| Index_type | Index structure; always `BTREE`. |
| Func | The expression of a function-based index, otherwise `NULL`. |
| Comment | Index comment. |
| Visible | `YES` if the optimizer can use the index, `NO` if it is invisible. |
| Shared | 1 for a [shared index](https://www.coradb.ai/manual/sql/tuning_special_index.html#shared-index) (one index structure shared by a table and its subclasses), 0 otherwise. |

```sql
SHOW INDEX FROM order_items;
```

| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Func | Comment | Visible | Shared |
|---|---:|---|---:|---|---|---:|---|---|---|---|---|---|---|---:|
| order_items | 1 | fk_order_items_order_id | 1 | order_id | A | 2914 | NULL | NULL | NO | BTREE | NULL | NULL | YES | 0 |
| order_items | 1 | fk_order_items_product_id | 1 | product_id | A | 1832 | NULL | NULL | NO | BTREE | NULL | NULL | YES | 0 |
| order_items | 0 | pk_order_items_order_id_product_id | 1 | order_id | A | 11230 | NULL | NULL | NO | BTREE | NULL | NULL | YES | 0 |
| order_items | 0 | pk_order_items_order_id_product_id | 2 | product_id | A | 11230 | NULL | NULL | NO | BTREE | NULL | NULL | YES | 0 |

## SHOW CREATE TABLE

Returns the statement that would create the table as it is now.

```text
SHOW CREATE TABLE table_name
```

```sql
SHOW CREATE TABLE countries;
```

| TABLE | CREATE TABLE |
|---|---|
| countries | `CREATE TABLE [countries] ([code] CHARACTER VARYING(8) NOT NULL, [name] CHARACTER VARYING(32) NOT NULL,  CONSTRAINT [pk_countries_code] PRIMARY KEY  ([code])) REUSE_OID, COLLATE utf8_bin` |

For a vertex or edge table the statement starts with `CREATE GRAPH VERTEX TABLE` or `CREATE GRAPH EDGE TABLE`:

```sql
SHOW CREATE TABLE product;
```

| TABLE | CREATE TABLE |
|---|---|
| product | `CREATE GRAPH VERTEX TABLE [product] ([id] INTEGER NOT NULL, [name] CHARACTER VARYING(64) NOT NULL, [description] CHARACTER VARYING(32) NOT NULL, [unit_price] NUMERIC(10,2) NOT NULL, [units_in_stock] SMALLINT NOT NULL,  CONSTRAINT [pk_product_id] PRIMARY KEY  ([id]),  INDEX [idx_product_name] ([name])) DONT_REUSE_OID, COLLATE utf8_bin` |

The statement is rebuilt from the catalog, not stored as you typed it: names are in lowercase and enclosed in brackets, types use their full names (`CHARACTER VARYING` for `VARCHAR`), and the table options in effect, such as `REUSE_OID` and the collation, are always written out.

## SHOW CREATE VIEW

Returns the query that defines a view.

```text
SHOW CREATE VIEW view_name
```

```sql
CREATE VIEW low_stock AS
    SELECT id, name, units_in_stock FROM product WHERE units_in_stock < 5;

SHOW CREATE VIEW low_stock;
```

| View | Create view |
|---|---|
| low_stock | `create view [low_stock] as select [product].[id], [product].[name], [product].[units_in_stock] from [product] [product] where [product].[units_in_stock]<5` |

## SHOW GRANTS

Lists the permissions granted to a user.

```text
SHOW GRANTS FOR user_name
```

```sql
CREATE USER report_reader;
GRANT SELECT ON orders TO report_reader;
GRANT SELECT, UPDATE ON order_items TO report_reader;

SHOW GRANTS FOR report_reader;
```

| Grants for REPORT_READER |
|---|
| GRANT SELECT ON orders TO REPORT_READER |
| GRANT SELECT, UPDATE ON order_items TO REPORT_READER |

See [GRANT](https://www.coradb.ai/manual/sql/authorization.html#grant) for the permissions you can give.


## SHOW COLLATION

Lists the collations available in the database.

```text
SHOW COLLATION [LIKE 'pattern']
```

| Column | Description |
|---|---|
| Collation | Collation name. |
| Charset | Character set of the collation. |
| Id | Collation ID. |
| Built_in | `Yes` for the collations built into CoraDB, which cannot be added or removed; `No` for collations added to the database. |
| Expansions | Whether the collation uses expansions. See [Expansion](https://www.coradb.ai/manual/sql/i18n_collation.html#expansion). |
| Strength | Number of levels considered when comparing characters. See [Collation properties](https://www.coradb.ai/manual/sql/i18n.html#collation-properties). |

```sql
SHOW COLLATION LIKE 'utf8_en%';
```

| Collation | Charset | Id | Built_in | Expansions | Strength |
|---|---|---:|---|---|---|
| utf8_en_ci | utf8 | 5 | Yes | No | Not applicable |
| utf8_en_cs | utf8 | 4 | Yes | No | Not applicable |

A database lists only the built-in collations unless locale-specific collations have been added to it; see [Internationalization](https://www.coradb.ai/manual/sql/i18n.html).

## SHOW TIMEZONES

Lists the time zone regions CoraDB knows.

```text
SHOW [FULL] TIMEZONES [LIKE 'pattern']
```

Without `FULL`, the result has one column, `timezone_region`. With `FULL` it has four:

| Column | Description |
|---|---|
| timezone_region | Region name, such as `Europe/Paris`. |
| region_offset | Offset from UTC without daylight saving time. |
| dst_offset | Daylight saving offset in effect now. `NULL` if the region has no daylight saving rules at all; `+00:00` if it has rules but none applies today. |
| dst_abbreviation | Abbreviation of the time currently in effect, such as `CET`. `NULL` if the region has no daylight saving rules. |

The offsets and abbreviations are those in effect at the current date and time. `LIKE` filters on `timezone_region`.

```sql
SHOW FULL TIMEZONES LIKE 'Europe/B%';
```

| timezone_region | region_offset | dst_offset | dst_abbreviation |
|---|---|---|---|
| Europe/Belfast | +00:00 | +00:00 | GMT |
| Europe/Belgrade | +01:00 | +00:00 | CET |
| Europe/Berlin | +01:00 | +00:00 | CET |
| Europe/Bratislava | +01:00 | +00:00 | CET |
| Europe/Brussels | +01:00 | +00:00 | CET |
| Europe/Bucharest | +02:00 | +00:00 | EET |
| Europe/Budapest | +01:00 | +00:00 | CET |
| Europe/Busingen | +01:00 | +00:00 | CET |

## SHOW ACCESS STATUS

Shows when each database user last logged in, and from where. Only the `DBA` user can run it.

```text
SHOW ACCESS STATUS [LIKE 'pattern' | WHERE expr]
```

| Column | Description |
|---|---|
| user_name | Database user. |
| last_access_time | Time of the user's last login, `NULL` if the user never logged in. |
| last_access_host | Host the user last connected from. |
| program_name | Client program used, for example `corasql` or a broker process such as `broker1_cora_cas_1`. |

```sql
SHOW ACCESS STATUS WHERE user_name = 'DBA';
```

## SHOW EXEC STATISTICS

Shows execution statistics collected for your session. Collection is off by default: set the session variable `@collect_exec_stats` to 1 to start it and to 0 to stop it.

```text
SHOW EXEC STATISTICS [ALL]
```

- Without `ALL`, the result has four rows with data page statistics: `data_page_fetches`, `data_page_dirties`, `data_page_ioreads` and `data_page_iowrites`.
- With `ALL`, it lists every statistic the server collects. For their meaning, see [statdump](https://www.coradb.ai/manual/admin/admin_statdump.html#statdump).

```sql
SET @collect_exec_stats = 1;
SELECT COUNT(*) FROM order_items WHERE discount_pct > 0;
SHOW EXEC STATISTICS;
```

| variable | value |
|---|---:|
| data_page_fetches | 44 |
| data_page_dirties | 0 |
| data_page_ioreads | 0 |
| data_page_iowrites | 0 |

The values depend on what the server already had in memory, so you will see different numbers.

## Diagnostics

The following statements show the internal state of database volumes, logs, tables, indexes and server threads. They are meant for administrators and for CoraDB support when analyzing performance or storage problems. Their output depends on the server and changes all the time; the examples show excerpts of real output in corasql's `;line on` format.

Some statements return additional columns that are reserved for internal use; they are not listed in the tables below.

### SHOW VOLUME HEADER

Shows the header of a database volume.

```text
SHOW VOLUME HEADER OF volume_id
```

| Column | Type | Description |
|---|---|---|
| Volume_id | INT | Volume identifier |
| Magic_symbol | VARCHAR(100) | Magic value for for a volume file |
| Io_page_size | INT | Size of DB volume |
| Purpose | VARCHAR(32) | Volume purposes, 'Permanent data purpose' or 'Temporary data purpose' |
| Type | VARCHAR(32) | Volume type, 'Permanent Volume' or 'Temporary Volume' |
| Sector_size_in_pages | INT | Size of sector in pages |
| Num_total_sectors | INT | Total number of sectors |
| Num_free_sectors | INT | Number of free sectors |
| Num_max_sectors | INT | Maximum number of sectors |
| Hint_alloc_sector | INT | Hint for next sector to be allocated |
| Sector_alloc_table_size_in_pages | INT | Size of sector allocation table in page |
| Sector_alloc_table_first_page | INT | First page of sector allocation table |
| Last_system_page | INT | Last system page |
| Creation_time | DATETIME | Database creation time |
| Db_charset | INT | Charset number of database |
| Checkpoint_lsa | VARCHAR(64) | Lowest log sequence address to start the recovery process of this volume |
| Boot_hfid | VARCHAR(64) | System Heap file for booting purposes and multi volumes |
| Full_name | VARCHAR(255) | The full path of volume |
| Next_volume_id | INT | Next volume identifier |
| Next_vol_full_name | VARCHAR(255) | The full path of next volume |
| Remarks | VARCHAR(64) | Volume remarks |

```sql
SHOW VOLUME HEADER OF 0;
```

```text
<00001> Volume_id           : 0
        Magic_symbol        : 'MAGIC SYMBOL = CORADB/Volume at disk location = 32'
        Io_page_size        : 16384
        Purpose             : 'Permanent data purpose'
        Type                : 'Permanent Volume'
        Sector_size_in_pages: 64
        Num_total_sectors   : 512
        Num_free_sectors    : 418
        ...
        Creation_time       : 05:50:05.000 PM 08/06/2026
        Db_charset          : 5
        ...
        Full_name           : '/home/qa/CORADB/databases/e-commerce/e-commerce'
        Next_volume_id      : -1
```

### SHOW LOG HEADER

Shows the header of the active log. Without `OF`, the header kept in the server's memory is shown; with `OF` *file_name*, the header stored in that log file.

```text
SHOW LOG HEADER [OF file_name]
```

| Column | Type | Description |
|---|---|---|
| Volume_id | INT | Volume identifier |
| Magic_symbol | VARCHAR(32) | Magic value for log file |
| Magic_symbol_location | INT | Magic symbol location from log page |
| Creation_time | DATETIME | Database creation time |
| Release | VARCHAR(32) | CoraDB Release version |
| Compatibility_disk_version | VARCHAR(32) | Compatibility of the database against the current release of CoraDB |
| Db_page_size | INT | Size of pages in the database |
| Log_page_size | INT | Size of log pages in the database |
| Shutdown | INT | Was the log shutdown |
| Next_trans_id | INT | Next transaction identifier |
| Num_avg_trans | INT | Number of average transactions |
| Num_avg_locks | INT | Average number of object locks |
| Num_active_log_pages | INT | Number of pages in the active log portion |
| Db_charset | INT | Charset number of database |
| First_active_log_page | BIGINT | Logical pageid at physical location 1 in active log |
| Current_append | VARCHAR(64) | Current append location |
| Checkpoint | VARCHAR(64) | Lowest log sequence address to start the recovery process |
| Next_archive_page_id | BIGINT | Next logical page to archive |
| Active_physical_page_id | INT | Physical location of logical page to archive |
| Next_archive_num | INT | Next log archive number |
| Last_archive_num_for_syscrashes | INT | Last log archive needed for system crashes |
| Last_deleted_archive_num | INT | Last deleted archive number |
| Backup_lsa_level0 | VARCHAR(64) | LSA of backup level 0 |
| Backup_lsa_level1 | VARCHAR(64) | LSA of backup level 1 |
| Backup_lsa_level2 | VARCHAR(64) | LSA of backup level 2 |
| Log_prefix | VARCHAR(256) | Log prefix name |
| Has_logging_been_skipped | INT | Whether or not logging skipped |
| Perm_status | VARCHAR(64) | Reserved for future expansion |
| Backup_info_level0 | VARCHAR(128) | Detail information of backup level 0. currently only backup start-time is used |
| Backup_info_level1 | VARCHAR(128) | Detail information of backup level 1. currently only backup start-time is used |
| Backup_info_level2 | VARCHAR(128) | Detail information of backup level 2. currently only backup start-time is used |
| Eof_lsa | VARCHAR(64) | EOF LSA |
| Smallest_lsa_at_last_checkpoint | VARCHAR(64) | The smallest LSA of the last checkpoint, can be NULL LSA |
| Next_mvcc_id | BIGINT | The next MVCCID will be used for the next transaction |
| Mvcc_op_log_lsa | VARCHAR(32) | The LSA used to link log entries for MVCC operation |
| Last_block_oldest_mvcc_id | BIGINT | Used to find the oldest MVCCID in a block of log data, can be NULL |
| Last_block_newest_mvcc_id | BIGINT | Used to find the newest MVCCID in a block of log data, can be NULL |

```sql
SHOW LOG HEADER;
```

```text
<00001> Volume_id                 : -2
        Magic_symbol              : 'CORADB/LogActive'
        Magic_symbol_location     : 16
        Creation_time             : 05:50:05.000 PM 08/06/2026
        Release                   : '1.0.0'
        Compatibility_disk_version: '11'
        Db_page_size              : 16384
        Log_page_size             : 16384
        Shutdown                  : 0
        ...
        Log_prefix                : 'e-commerce'
        ...
```

### SHOW ARCHIVE LOG HEADER

Shows the header of an archive log file. Give the full path of the file, because a relative name is resolved from the server's working directory.

```text
SHOW ARCHIVE LOG HEADER OF file_name
```

| Column | Type | Description |
|---|---|---|
| Volume_id | INT | Identifier of log volume |
| Magic_symbol | VARCHAR(32) | Magic value for file/magic Unix utility |
| Magic_symbol_location | INT | Magic symbol location from log page |
| Creation_time | DATETIME | Database creation time |
| Next_trans_id | BIGINT | Next transaction identifier |
| Num_pages | INT | Number of pages in the archive log |
| First_page_id | BIGINT | Logical page id at physical location 1 in archive log |
| Archive_num | INT | The archive log number |

```sql
SHOW ARCHIVE LOG HEADER OF '/home/qa/CORADB/databases/e-commerce/e-commerce_lgar006';
```

The result has one row with the columns listed above.

### SHOW HEAP HEADER

Shows the header page of a table's heap file, where its rows are stored. For a partitioned table, `ALL` shows the header of the table and of each partition.

```text
SHOW [ALL] HEAP HEADER OF table_name
```

| Column | Type | Description |
|---|---|---|
| Table_name | VARCHAR(256) | Table name |
| Class_oid | VARCHAR(64) | Format: (volidslotid) |
| Volume_id | INT | Volume identifier where the file reside |
| File_id | INT | File identifier |
| Header_page_id | INT | First page identifier (the header page) |
| Overflow_vfid | VARCHAR(64) | Overflow file identifier (if any) |
| Next_vpid | VARCHAR(64) | Next page (i.e., the 2nd page of heap file) |
| Unfill_space | INT | Stop inserting when page has run below this. leave it for updates |
| Estimates_num_pages | BIGINT | Estimation of number of heap pages. |
| Estimates_num_recs | BIGINT | Estimation of number of objects in heap |
| Estimates_avg_rec_len | INT | Estimation total length of records |
| Estimates_num_high_best | INT | Number of pages in the best array that we believe have at least HEAP_DROP_FREE_SPACE. When this number goes to zero and there are at least other HEAP_NUM_BEST_SPACESTATS best pages, we look for them |
| Estimates_num_others_high_best | INT | Total of other believed known best pages, which are not included in the best array and we believe they have at least HEAP_DROP_FREE_SPACE |
| Estimates_head | INT | Head of best circular array |
| Estimates_best_list | VARCHAR(512) | Format: '((best\[0\].vpid.volidbest\[9\].vpid.pageid), best\[9\].freespace)' |
| Estimates_num_second_best | INT | Number of second best hints. The hints are in "second_best" array. They are used when finding new best pages. |
| Estimates_head_second_best | INT | Index of head of second best hints. A new second best hint will be stored on this index. |
| Estimates_tail_second_best | INT | Tail of the second best list |
| Estimates_num_substitutions | INT | Number of page substitutions. This will be used to insert a new second best page into second best hints. |
| Estimates_second_best_list | VARCHAR(512) | Format: '(second_best\[0\].vpid.volidsecond_best\[9\].vpid.pageid)' |
| Estimates_last_vpid | VARCHAR(64) | Format: '(volid\ | pageid)' |
| Estimates_full_search_vpid | VARCHAR(64) | Format: '(volid\ | pageid)' |

```sql
SHOW HEAP HEADER OF orders;
```

```text
<00001> Table_name           : 'orders'
        Class_oid            : '(0|202|9)'
        Volume_id            : 0
        File_id              : 3776
        Header_page_id       : 3777
        Overflow_vfid        : '(-1|-1)'
        Next_vpid            : '(0|3778)'
        Unfill_space         : 1634
        Estimates_num_pages  : 23
        Estimates_num_recs   : 2914
        Estimates_avg_rec_len: 107
        ...
```

### SHOW HEAP CAPACITY

Shows how much space a table's heap file uses. For a partitioned table, `ALL` shows the table and each partition.

```text
SHOW [ALL] HEAP CAPACITY OF table_name
```

| Column | Type | Description |
|---|---|---|
| Table_name | VARCHAR(256) | Table name |
| Class_oid | VARCHAR(64) | Heap file descriptor |
| Volume_id | INT | Volume identifier where the file reside |
| File_id | INT | File identifier |
| Header_page_id | INT | First page identifier (the header page) |
| Num_recs | BIGINT | Total Number of objects |
| Num_relocated_recs | BIGINT | Number of relocated records |
| Num_overflowed_recs | BIGINT | Number of big records |
| Num_pages | BIGINT | Total number of heap pages |
| Avg_rec_len | INT | Average object length |
| Avg_free_space_per_page | INT | Average free space per page |
| Avg_free_space_per_page_except_last_page | INT | Average free space per page without taking in consideration last page |
| Avg_overhead_per_page | INT | Average overhead per page |
| Repr_id | INT | Currently cached catalog column info |
| Num_total_attrs | INT | Total number of columns |
| Num_fixed_width_attrs | INT | Number of the fixed width columns |
| Num_variable_width_attrs | INT | Number of variable width columns |
| Num_shared_attrs | INT | Number of shared columns |
| Num_class_attrs | INT | Number of table columns |
| Total_size_fixed_width_attrs | INT | Total size of the fixed width columns |

```sql
SHOW HEAP CAPACITY OF orders;
```

```text
<00001> Table_name                              : 'orders'
        Class_oid                               : '(0|202|9)'
        Volume_id                               : 0
        File_id                                 : 3776
        Header_page_id                          : 3777
        Num_recs                                : 2910
        Num_relocated_recs                      : 0
        Num_overflowed_recs                     : 0
        Num_pages                               : 23
        Avg_rec_len                             : 106
        Avg_free_space_per_page                 : 2219
        Avg_free_space_per_page_except_last_page: 1781
        Avg_overhead_per_page                   : 510
        Repr_id                                 : 2
        Num_total_attrs                         : 6
        Num_fixed_width_attrs                   : 5
        Num_variable_width_attrs                : 1
        Num_shared_attrs                        : 0
        Num_class_attrs                         : 0
        Total_size_fixed_width_attrs            : 32
```

### SHOW SLOTTED PAGE HEADER

Shows the header of a slotted page, the page format used for table rows. Identify the page by volume and page number, for example the `Header_page_id` returned by `SHOW HEAP HEADER`.

```text
SHOW SLOTTED PAGE HEADER {WHERE | OF} VOLUME = volume_num AND PAGE = page_num
```

| Column | Type | Description |
|---|---|---|
| Volume_id | INT | Volume id of the page |
| Page_id | INT | Page id of the page |
| Num_slots | INT | Number of allocated slots for the page |
| Num_records | INT | Number of records on page |
| Anchor_type | VARCHAR(32) | One of flowing: ANCHORED, ANCHORED_DONT_REUSE_SLOTS, UNANCHORED_ANY_SEQUENCE, UNANCHORED_KEEP_SEQUENCE |
| Alignment | VARCHAR(8) | Alignment for records, one of flowing: CHAR, SHORT, INT, DOUBLE |
| Total_free_area | INT | Total free space on page |
| Contiguous_free_area | INT | Contiguous free space on page |
| Free_space_offset | INT | Byte offset from the beginning of the page to the first free byte area on the page |
| Need_update_best_hint | INT | True if saving is need for recovery (undo) |
| Is_saving | INT | True if we should update best pages hint for this page. |
| Flags | INT | Flag value of the page |

```sql
SHOW SLOTTED PAGE HEADER OF VOLUME = 0 AND PAGE = 3777;
```

```text
<00001> Volume_id            : 0
        Page_id              : 3777
        Num_slots            : 130
        Num_records          : 130
        Anchor_type          : 'ANCHORED_DONT_REUSE_SLOTS'
        Alignment            : 'INT'
        Total_free_area      : 1676
        Contiguous_free_area : 1620
        Free_space_offset    : 14204
        Need_update_best_hint: 0
        Is_saving            : 1
        Flags                : 0
```

### SHOW SLOTTED PAGE SLOTS

Shows every slot of a slotted page, one row per slot.

```text
SHOW SLOTTED PAGE SLOTS {WHERE | OF} VOLUME = volume_num AND PAGE = page_num
```

| Column | Type | Description |
|---|---|---|
| Volume_id | INT | Volume id of the page |
| Page_id | INT | Page id of the page |
| Slot_id | INT | The slot id |
| Offset | INT | Byte offset from the beginning of the page to the beginning of the record |
| Type | VARCHAR(32) | Record type, one of flowing: REC_UNKNOWN, REC_ASSIGN_ADDRESS, REC_HOME, REC_NEWHOME, REC_RELOCATION, REC_BIGONE, REC_MARKDELETED, REC_DELETED_WILL_REUSE |
| Length | INT | Length of record |
| Waste | INT | Whether or not wasted |

```sql
SHOW SLOTTED PAGE SLOTS OF VOLUME = 0 AND PAGE = 3777;
```

| Volume_id | Page_id | Slot_id | Offset | Type | Length | Waste |
|---:|---:|---:|---:|---|---:|---:|
| 0 | 3777 | 0 | 32 | HOME | 296 | 0 |
| 0 | 3777 | 1 | 328 | HOME | 108 | 0 |
| 0 | 3777 | 2 | 436 | HOME | 112 | 0 |
| … | | | | | | |

The page holds 130 slots; only the first three are shown.

### SHOW INDEX HEADER

Shows the header page of an index. With `ALL` and no index name, it shows the headers of all indexes of the table.

```text
SHOW INDEX HEADER OF table_name.index_name
SHOW ALL INDEXES HEADER OF table_name
```

| Column | Type | Description |
|---|---|---|
| Table_name | VARCHAR(256) | Table name |
| Index_name | VARCHAR(256) | Index name |
| Btid | VARCHAR(64) | BTID (volidroot_pageid) |
| Node_level | INT | Node level (1 for LEAF, 2 or more for NON_LEAF) |
| Max_key_len | INT | Maximum key length for the subtree |
| Num_oids | INT | Number of OIDs stored in the Btree |
| Num_nulls | INT | Number of NULLs (they aren't stored) |
| Num_keys | INT | Number of unique keys in the Btree |
| Topclass_oid | VARCHAR(64) | Topclass oid or NULL OID (non unique index)(volidslotid) |
| Unique | INT | Unique or non-unique |
| Overflow_vfid | VARCHAR(32) | VFID (volid\ | fileid) |
| Key_type | VARCHAR(256) | Type name |
| Columns | VARCHAR(256) | The list of columns which consists of the index |

```sql
SHOW INDEX HEADER OF orders.idx_orders_order_date;
```

```text
<00001> Table_name   : 'orders'
        Index_name   : 'idx_orders_order_date'
        Btid         : '(0|5824|5825)'
        Node_level   : 2
        Max_key_len  : 4
        Num_oids     : -1
        Num_nulls    : -1
        Num_keys     : -1
        Topclass_oid : '(0|202|9)'
        Unique       : 0
        Overflow_vfid: '(-1|-1)'
        Key_type     : 'date'
        Columns      : 'order_date'
```

### SHOW INDEX CAPACITY

Shows how much space an index uses and how its keys are distributed. With `ALL` and no index name, it shows every index of the table.

```text
SHOW INDEX CAPACITY OF table_name.index_name
SHOW ALL INDEXES CAPACITY OF table_name
```

| Column | Type | Description |
|---|---|---|
| Table_name | VARCHAR(256) | Table name |
| Index_name | VARCHAR(256) | Index name |
| Btid | VARCHAR(64) | BTID (volidroot_pageid) |
| Num_distinct_key | INT | Distinct key count (in leaf pages) |
| Total_value | INT | Total number of values stored in tree |
| Avg_num_value_per_key | INT | Average number of values (OIDs) per key |
| Num_leaf_page | INT | Leaf page count |
| Num_non_leaf_page | INT | NonLeaf page count |
| Num_total_page | INT | Total page count |
| Height | INT | Height of the tree |
| Avg_key_len | INT | Average key length |
| Avg_rec_len | INT | Average page record length |
| Total_space | VARCHAR(64) | Total space occupied by index |
| Total_used_space | VARCHAR(64) | Total used space in index |
| Total_free_space | VARCHAR(64) | Total free space in index |
| Avg_num_page_key | INT | Average page key count (in leaf pages) |
| Avg_page_free_space | VARCHAR(64) | Average page free space |

```sql
SHOW ALL INDEXES CAPACITY OF order_items;
```

| Index_name | Num_distinct_key | Total_value | Num_total_page | Height | Total_space | Total_used_space | Total_free_space |
|---|---:|---:|---:|---:|---|---|---|
| fk_order_items_order_id | 2926 | 11195 | 10 | 2 | 159.6K | 111.1K | 48.5K |
| fk_order_items_product_id | 1827 | 11179 | 8 | 2 | 127.7K | 90.4K | 37.2K |
| pk_order_items_order_id_product_id | 11221 | 11221 | 23 | 2 | 367.1K | 264.9K | 102.2K |

A selection of the columns is shown.

### SHOW CRITICAL SECTIONS

Shows every critical section of the database server: the internal locks that protect shared server structures, with their current holders and waiters and the accumulated wait times. Long waits on one section point to contention.

```text
SHOW CRITICAL SECTIONS
```

| Column | Type | Description |
|---|---|---|
| Index | INT | The index of CS |
| Name | VARCHAR(32) | The name of CS |
| Num_holders | VARCHAR(16) | The number of CS holders. This has one of these values: 'N readers', '1 writer', 'none' |
| Num_waiting_readers | INT | The number of waiting readers |
| Num_waiting_writers | INT | The number of waiting writers |
| Owner_thread_index | INT | The thread index of CS owner writer, NULL if no owner |
| Owner_tran_index | INT | Transaction index of CS owner writer, NULL if no owner |
| Total_enter_count | BIGINT | Total count of enterers |
| Total_waiter_count | BIGINT | Total count of waiters |
| Waiting_promoter_thread_index | INT | The thread index of waiting promoter, NULL if no waiting promoter |
| Max_waiting_msecs | NUMERIC(10,3) | Maximum waiting time (millisecond) |
| Total_waiting_msecs | NUMERIC(10,3) | Total waiting time (millisecond) |

```sql
SHOW CRITICAL SECTIONS;
```

| Index | Name | Num_holders | Num_waiting_readers | Num_waiting_writers | Total_enter_count | Total_waiter_count | Max_waiting_msecs | Total_waiting_msecs |
|---:|---|---|---:|---:|---:|---:|---:|---:|
| 0 | WFG | none | 0 | 0 | 0 | 0 | 0.000 | 0.000 |
| 1 | LOG | none | 0 | 0 | 214651 | 83 | 868.587 | 3747.675 |
| 2 | LOCATOR_CLASSNAME_TABLE | none | 0 | 0 | 504436 | 0 | 0.175 | 63.067 |
| … | | | | | | | | |

A selection of the columns and the first three of the 17 rows are shown.


### SHOW TRANSACTION TABLES

Shows the transaction descriptors of all active transactions, one row per transaction: who is connected, from which program and host, the transaction state, and how long its current query has been running. Use it to find the `Tran_index` for [KILL](https://www.coradb.ai/manual/sql/query/kill.html). The rows are not a consistent snapshot; values can change while they are read.

```text
SHOW {TRAN | TRANSACTION} TABLES [WHERE expr]
```

| Column | Type | Description |
|---|---|---|
| Tran_index | INT | Index on the transaction table or NULL for unassigned transaction descriptor slot |
| Tran_id | INT | Transaction Identifier |
| Is_loose_end | INT | 0 for Ordinary transactions, 1 for loose-end transactions |
| State | VARCHAR(64) | State of the transaction. One of the following: 'TRAN_RECOVERY', 'TRAN_ACTIVE', 'TRAN_UNACTIVE_COMMITTED', 'TRAN_UNACTIVE_WILL_COMMIT', 'TRAN_UNACTIVE_COMMITTED_WITH_POSTPONE', 'TRAN_UNACTIVE_ABORTED', 'TRAN_UNACTIVE_UNILATERALLY_ABORTED', 'TRAN_UNACTIVE_2PC_PREPARE', 'TRAN_UNACTIVE_2PC_COLLECTING_PARTICIPANT_VOTES', 'TRAN_UNACTIVE_2PC_ABORT_DECISION', 'TRAN_UNACTIVE_2PC_COMMIT_DECISION', 'TRAN_UNACTIVE_COMMITTED_INFORMING_PARTICIPANTS', 'TRAN_UNACTIVE_ABORTED_INFORMING_PARTICIPANTS','TRAN_STATE_UNKNOWN' |
| Isolation | VARCHAR(64) | Isolation level of the transaction. One of the following: 'SERIALIZABLE', 'REPEATABLE READ', 'COMMITTED READ', 'TRAN_UNKNOWN_ISOLATION' |
| Wait_msecs | INT | Wait until this number of milliseconds for locks. |
| Head_lsa | VARCHAR(64) | First log address of transaction. |
| Tail_lsa | VARCHAR(64) | Last log record address of transaction. |
| Undo_next_lsa | VARCHAR(64) | Next log record address of transaction for UNDO purposes. |
| Postpone_next_lsa | VARCHAR(64) | Next address of a postpone record to be executed. |
| Savepoint_lsa | VARCHAR(64) | Address of last save-point. |
| Topop_lsa | VARCHAR(64) | Address of last top operation. |
| Tail_top_result_lsa | VARCHAR(64) | Address of last partial abort/commit. |
| Client_id | INT | Unique identifier of client application bind to transaction. |
| Client_type | VARCHAR(40) | Type of client, for example 'SYSTEM_INTERNAL', 'DEFAULT', 'corasql' or 'BROKER' |
| Client_info | VARCHAR(256) | General information of client application. |
| Client_db_user | VARCHAR(40) | Current login database account from client application. |
| Client_program | VARCHAR(256) | Program name of client application. |
| Client_login_user | VARCHAR(16) | Current login user of OS which running the client application. |
| Client_host | VARCHAR(64) | Host name of client application. |
| Client_pid | INT | Process id of client application. |
| Topop_depth | INT | Depth of nested top operation. |
| Num_unique_btrees | INT | Number of unique btrees contained in unique_stat_info array. |
| Max_unique_btrees | INT | Size of unique_stat_info_array. |
| Interrupt | INT | The flag of whether or not interrupt current transaction. 0 for No, 1 for Yes. |
| Num_transient_classnames | INT | Number of transient classnames by this transaction. |
| First_save_entry | VARCHAR(20) | First save entry for the transaction, display address pointer as 0x12345678 or NULL for 0x00000000. |
| Tran_unique_stats | VARCHAR(20) | Local statistical info for multiple row. display address pointer as 0x12345678 or NULL for 0x00000000. |
| Modified_class_list | VARCHAR(20) | List of dirty classes, display address pointer as 0x12345678 or NULL for 0x00000000. |
| Num_temp_files | INT | Number of temporary files. |
| Waiting_for_res | VARCHAR(20) | Waiting resource. Just display address pointer as 0x12345678 or NULL for 0x00000000. |
| Has_deadlock_priority | INT | Whether or not have deadlock priority. 0 for No, 1 for Yes. |
| Query_timeout | DATETIME | A query should be executed before query_timeout time or NULL for waiting until query complete. |
| Query_start_time | DATETIME | Current query start time or NULL for query completed. |
| Tran_start_time | DATETIME | Current transaction start time or NULL for transaction completed. |
| Xasl_id | VARCHAR(64) | Vpid:(volidpageid) or NULL for query completed. |
| Disable_modifications | INT | Disable modification if greater than zero. |
| Abort_reason | VARCHAR(40) | Reason of transaction aborted. One of the following: 'NORMAL', 'ABORT_DUE_TO_DEADLOCK', 'ABORT_DUE_ROLLBACK_ON_ESCALATION' |

```sql
SHOW TRANSACTION TABLES WHERE client_type = 'BROKER';
```

```text
<00001> Tran_index       : 1
        Tran_id          : 1176992
        Is_loose_end     : 0
        State            : 'ACTIVE'
        Isolation        : 'COMMITTED READ'
        Wait_msecs       : -1
        ...
        Client_type      : 'BROKER'
        Client_info      : ''
        Client_db_user   : 'DBA'
        Client_program   : 'broker1_cora_cas_1'
        Client_login_user: 'root'
        ...
        Query_start_time : 01:18:09.334 AM 11/18/2026
        Tran_start_time  : 01:18:09.334 AM 11/18/2026
        ...
```

### SHOW THREADS

Shows the server's threads, sorted by `Index`: worker threads that run client requests and the server's own daemon threads. For a thread that waits for a lock, the `Lockwait_*` columns show what it waits for. The rows are not a consistent snapshot. In standalone mode (`corasql -S`) the result is empty.

```text
SHOW THREADS [WHERE expr]
```

| Column | Type | Description |
|---|---|---|
| Index | INT | Thread entry index. |
| Jobq_index | INT | Job queue index only for worker threads. NULL for non-worker threads. |
| Thread_id | BIGINT | Thread id. |
| Tran_index | INT | Transaction index to which this thread belongs. If no related tran index, NULL. |
| Type | VARCHAR(8) | Thread type. One of the following: 'MASTER', 'SERVER', 'WORKER', 'DAEMON', 'VACUUM_MASTER', 'VACUUM_WORKER', 'NONE', 'UNKNOWN'. |
| Status | VARCHAR(8) | Thread status. One of the following: 'DEAD', 'FREE', 'RUN', 'WAIT', 'CHECK'. |
| Resume_status | VARCHAR(32) | Resume status. One of the following: 'RESUME_NONE', 'RESUME_DUE_TO_INTERRUPT', 'RESUME_DUE_TO_SHUTDOWN', 'PGBUF_SUSPENDED', 'PGBUF_RESUMED', 'JOB_QUEUE_SUSPENDED', 'JOB_QUEUE_RESUMED', 'CSECT_READER_SUSPENDED', 'CSECT_READER_RESUMED', 'CSECT_WRITER_SUSPENDED', 'CSECT_WRITER_RESUMED', 'CSECT_PROMOTER_SUSPENDED', 'CSECT_PROMOTER_RESUMED', 'CSS_QUEUE_SUSPENDED', 'CSS_QUEUE_RESUMED', 'QMGR_ACTIVE_QRY_SUSPENDED', 'QMGR_ACTIVE_QRY_RESUMED', 'QMGR_MEMBUF_PAGE_SUSPENDED', 'QMGR_MEMBUF_PAGE_RESUMED', 'HEAP_CLSREPR_SUSPENDED', 'HEAP_CLSREPR_RESUMED', 'LOCK_SUSPENDED', 'LOCK_RESUMED', 'LOGWR_SUSPENDED', 'LOGWR_RESUMED' |
| Net_request | VARCHAR(64) | The net request name in net_requests array, such as: 'LC_ASSIGN_OID'. If not request name, shows NULL |
| Conn_client_id | INT | Client id whom this thread is responding, if no client id, shows NULL |
| Conn_request_id | INT | Request id which this thread is processing, if no request id, shows NULL |
| Conn_index | INT | Connection index, if not connection index, shows NULL |
| Last_error_code | INT | Last error code |
| Last_error_msg | VARCHAR(256) | Last error message, if message length is more than 256, it will be truncated, If no error message, shows NULL |
| Private_heap_id | VARCHAR(20) | The address of id of thread private memory allocator, such as: 0x12345678. If no related heap id, shows NULL. |
| Query_entry | VARCHAR(20) | The address of the QMGR_QUERY_ENTRY\*, such as: 0x12345678, if no related QMGR_QUERY_ENTRY, shows NULL. |
| Interrupted | INT | 0 or 1, is this request/transaction interrupted |
| Shutdown | INT | 0 or 1, is server going down? |
| Check_interrupt | INT | 0 or 1 |
| Wait_for_latch_promote | INT | 0 or 1, whether this thread is waiting for latch promotion. |
| Lockwait_blocked_mode | VARCHAR(24) | Lockwait blocked mode. One of the following: 'NULL_LOCK', 'IS_LOCK', 'S_LOCK', 'IS_LOCK', 'IX_LOCK', 'SIX_LOCK', 'X_LOCK', 'SCH_M_LOCK', 'UNKNOWN' |
| Lockwait_start_time | DATETIME | Start blocked time, if not in blocked state, shows NULL |
| Lockwait_msecs | INT | Time in milliseconds, if not in blocked state, shows NULL |
| Lockwait_state | VARCHAR(24) | The lock wait state such as: 'SUSPENDED', 'RESUMED', 'RESUMED_ABORTED_FIRST', 'RESUMED_ABORTED_OTHER', 'RESUMED_DEADLOCK_TIMEOUT', 'RESUMED_TIMEOUT', 'RESUMED_INTERRUPT'. If not in blocked state, shows NULL |
| Next_wait_thread_index | INT | The next wait thread index, if not exist, shows NULL |
| Next_tran_wait_thread_index | INT | The next wait thread index in lock manager, if not exist, shows NULL |
| Next_worker_thread_index | INT | The next worker thread index in css_Job_queue.worker_thrd_list, if not exist, shows NULL |

```sql
SHOW THREADS WHERE status <> 'FREE' AND type = 'WORKER';
```

```text
<00001> Index        : 1
        Jobq_index   : NULL
        Thread_id    : 0
        Tran_index   : NULL
        Type         : 'WORKER'
        Status       : 'DEAD'
        Resume_status: 'RESUME_NONE'
        ...
```

### SHOW JOB QUEUES

Shows the job queues of the server's worker threads, with how many workers are busy. In standalone mode the result is empty.

```text
SHOW JOB QUEUES
```

| Column | Type | Description |
|---|---|---|
| Jobq_index | INT | The index of job queue |
| Num_total_workers | INT | Total number of work threads of the queue |
| Num_busy_workers | INT | The number of busy worker threads of the queue |
| Num_connection_workers | INT | The number of connection worker threads of the queue |

```sql
SHOW JOB QUEUES;
```

| Jobq_index | Num_total_workers | Num_busy_workers | Num_connection_workers |
|---:|---:|---:|---:|
| 0 | 13 | 0 | 0 |
| 1 | 13 | 1 | 0 |
| 2 | 13 | 0 | 0 |
| … | | | |

The first three of the eight queues are shown.

### SHOW PAGE BUFFER STATUS

Shows the state of the data page buffer pool: hit rate, how the pages are used, and read and write rates. A hit rate well below 100% under normal load suggests that the buffer (`data_buffer_size`) is too small for the working set.

```text
SHOW PAGE BUFFER STATUS
```

| Column | Type | Description |
|---|---|---|
| Hit_rate | NUMERIC(13,10) | The buffer pool hit rate (since the last printout) |
| Num_hit | BIGINT | The number of buffer hits (since the last printout) |
| Num_page_request | BIGINT | The number of page requests (since the last printout) |
| Pool_size | INT | Buffer pool size in pages |
| Page_size | INT | Data page size |
| Free_pages | INT | The number of free pages in the buffer pool |
| Victim_candidate_pages | INT | The number of victim candidate pages in the cold LRU area |
| Clean_pages | INT | The number of clean pages in the buffer pool |
| Dirty_pages | INT | The number of dirty pages in the buffer pool |
| Num_index_pages | INT | The number of index pages in the buffer pool |
| Num_data_pages | INT | The number of data pages in the buffer pool |
| Num_system_pages | INT | The number of system pages in the buffer pool |
| Num_temp_pages | INT | The number of temp pages in the buffer pool |
| Num_pages_created | BIGINT | The number of pages created in the buffer pool (since the last printout) |
| Num_pages_written | BIGINT | The number of pages written to disk in the buffer pool (since the last printout) |
| Pages_written_rate | NUMERIC(20,10) | The number of pages written per second (since the last printout) |
| Num_pages_read | BIGINT | The number of pages read from disk in the buffer pool (since the last printout) |
| Pages_read_rate | NUMERIC(20,10) | The number of pages read per second (since the last printout) |
| Num_flusher_waiting_threads | INT | The number of waiting threads for flusher |

```sql
SHOW PAGE BUFFER STATUS;
```

```text
<00001> Hit_rate              : 99.9963850819
        Num_hit               : 10566939
        Num_page_request      : 10567321
        Pool_size             : 32768
        Page_size             : 16392
        Free_pages            : 32272
        Victim_candidate_pages: 3
        Clean_pages           : 32748
        Dirty_pages           : 20
        Num_index_pages       : 103
        Num_data_pages        : 197
        Num_system_pages      : 108
        Num_temp_pages        : 66
        ...
```

## See also

- [Catalog views](https://www.coradb.ai/manual/sql/catalog.html): query the same metadata with `SELECT`
- [KILL](https://www.coradb.ai/manual/sql/query/kill.html)
- [Database administration utilities](https://www.coradb.ai/manual/admin/admin_utils.html)
