Back to Yugabyte Db

View metadata for YSQL/YCQL/system tablets on a server

docs/content/v2.25/explore/observability/yb-local-tablets.md

2026.1.0.0-b257.3 KB
Original Source

Use YSQL yb_local_tablets view to fetch the metadata for YSQL, YCQL, and system tablets of a node. This view returns the same information that is available on <yb-tserver-ip>:9000/tablets.

While debugging a system with Active Session History, the tablet_id column of this view can be joined with the wait_event_aux column of the yb_active_session_history view. For example, see Detect a hot shard.

The columns of the yb_local_tablets view are described in the following table.

ColumnTypeDescription
tablet_idtext16 byte UUID of the tablet.
table_idtext16 byte UUID of the table which the tablet is part of.
table_typetextType of the table. Can be YSQL, YCQL, System, or Unknown.
namespace_nametextName of the database or the keyspace.
ysql_schema_nametextYSQL schema name. Empty for YCQL, System, and Unknown table types.
table_nametextName of the table which the tablet is part of.
partition_key_startbyteaStart key of the partition (inclusive).
partition_key_endbyteaEnd key of the partition (exclusive).
statetextState of the tablet. Check the next section for possible values.

Possible tablet states

The state column can have the following values:

StateDescription
TABLET_DATA_COPYINGThe tablet is doing remote bootstrap.
TABLET_DATA_READYFresh empty tablets or successfully remote bootstrapped tablets.
TABLET_DATA_DELETEDThe tablet replica has been deleted from this particular node because the tablet has been deleted from the table.
TABLET_DATA_TOMBSTONEDThe tablet replica has been deleted from this particular node but the tablet itself is still part of the table and might have data on other nodes.
TABLET_DATA_SPLIT_COMPLETEDThe tablet split has been completed.
TABLET_DATA_INIT_STARTEDThe tablet has been initialized as a subtablet of another tablet undergoing a split.

Examples

{{% explore-setup-single-new %}}

Note that as this view is accessible via YSQL, run your examples using ysqlsh.

Describe the columns in the view

sql
yugabyte=# \d yb_local_tablets
output
              View "pg_catalog.yb_local_tablets"
       Column        | Type  | Collation | Nullable | Default
---------------------+-------+-----------+----------+---------
 tablet_id           | text  |           |          |
 table_id            | text  |           |          |
 table_type          | text  |           |          |
 namespace_name      | text  |           |          |
 ysql_schema_name    | text  |           |          |
 table_name          | text  |           |          |
 partition_key_start | bytea |           |          |
 partition_key_end   | bytea |           |          |
 state               | text  |           |          |

Get basic information

This example includes a YCQL table, a hash-partitioned YSQL table, and a range-partitioned YSQL table.

sql
yugabyte=# SELECT * FROM yb_local_tablets ORDER BY table_name, partition_key_start ASC NULLS FIRST;
output
            tablet_id             |             table_id             | table_type | namespace_name  | ysql_schema_name |       table_name        |  partition_key_start   |   partition_key_end    |       state
----------------------------------+----------------------------------+------------+-----------------+------------------+-------------------------+------------------------+------------------------+-------------------
 230de13ea3f045c2bc817046c96bfb9e | db82083fb39e47b0976b99f3612fa144 | YCQL       | ybdemo_keyspace |                  | cassandrakeyvalue       |                        | \x8000                 | TABLET_DATA_READY
 cb8ef7044b094709870d421fccd568a4 | db82083fb39e47b0976b99f3612fa144 | YCQL       | ybdemo_keyspace |                  | cassandrakeyvalue       | \x8000                 |                        | TABLET_DATA_READY
 76010b63fc714389ab97b432d9db78ac | 000033c1000030008000000000004000 | YSQL       | postgres        | public           | postgresqlkeyvalue      |                        | \x8000                 | TABLET_DATA_READY
 a5913f11706c4d8a80d74b7001dfe157 | 000033c1000030008000000000004000 | YSQL       | postgres        | public           | postgresqlkeyvalue      | \x8000                 |                        | TABLET_DATA_READY
 110ae7c832e7418bbfb56222a3e6a7ca | 000033c3000030008000000000004006 | YSQL       | yugabyte        | public           | range_partitioned_table |                        | \x48800000015361000021 | TABLET_DATA_READY
 746f84ac4a894b9c914fd4a89d5f89fc | 000033c3000030008000000000004006 | YSQL       | yugabyte        | public           | range_partitioned_table | \x48800000015361000021 | \x48800000025362000021 | TABLET_DATA_READY
 f584ca3aa57e43278fd4b5042ab116be | 000033c3000030008000000000004006 | YSQL       | yugabyte        | public           | range_partitioned_table | \x48800000025362000021 | \x48800000035363000021 | TABLET_DATA_READY
 6d566b767f0347879934338e1642f58e | 000033c3000030008000000000004006 | YSQL       | yugabyte        | public           | range_partitioned_table | \x48800000035363000021 |                        | TABLET_DATA_READY
 bc90fa993cc340458d7d4500213e5aed | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            |                        | \x2000                 | TABLET_DATA_READY
 d106f1c5039a4127bf1bee83c5c3fec8 | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \x2000                 | \x4000                 | TABLET_DATA_READY
 045af4a5aa744e1fb06e41f4af134ee0 | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \x4000                 | \x6000                 | TABLET_DATA_READY
 0f63fe4806824a4ab17b0fd9cf144b8a | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \x6000                 | \x8000                 | TABLET_DATA_READY
 a7251899b197456fbec72f7cc64cc7ad | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \x8000                 | \xa000                 | TABLET_DATA_READY
 46035a0bc4144f8ea372c93dc5d3a8b6 | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \xa000                 | \xc000                 | TABLET_DATA_READY
 1a13e5b16aa841608390c56e63deab20 | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \xc000                 | \xe000                 | TABLET_DATA_READY
 5b452227726444a78d1c84aaaf44f5c0 | 4c9c54fb3fcc47dcb29e58899afc5e21 | System     | system          |                  | transactions            | \xe000                 |                        | TABLET_DATA_READY