SHOW EXPERIMENTAL_RANGES

The SHOW EXPERIMENTAL_RANGES statement shows information about the ranges that make up a specific table's data, including:

  • The start and end keys for the range(s)
  • The range ID(s)
  • Which nodes contain the range replicas
  • Which node contains the range that is the leaseholder
    This information is useful for verifying that:

  • The "follow-the-workload" feature is operating as expected.

  • Range splits specified by the SPLIT AT statement were created as expected.

Warning:

This is an experimental feature. The interface and output are subject to change.

Synopsis

SHOWEXPERIMENTAL_RANGESFROMTABLEtable_nameINDEXtable_index_name

Required privileges

The user must have the SELECT privilege on the target table.

Parameters

ParameterDescription
table_nameThe name of the table you want range information about.
table_name_with_indexThe name of the index you want range information about.

Examples

The examples in this section operate on a hypothetical "user credit information" table filled with dummy data, running on a 5-node cluster.

  1. > CREATE TABLE credit_users (
  2. id INT PRIMARY KEY,
  3. area_code INTEGER NOT NULL,
  4. name STRING UNIQUE NOT NULL,
  5. address STRING NOT NULL,
  6. zip_code INTEGER NOT NULL,
  7. credit_score INTEGER NOT NULL
  8. );

We added a secondary index to the table on the area_code column:

  1. > CREATE INDEX areaCode on credit_users(area_code);

Next, we ran a couple of SPLIT ATs on the table and the index:

  1. > ALTER TABLE credit_users SPLIT AT VALUES (5), (10), (15);
  1. > ALTER INDEX credit_users@areaCode SPLIT AT VALUES (400), (600), (999);

Note:

In the example output below, a NULL in the Start Key column means "beginning of table".A NULL in the End Key column means "end of table".

Show ranges for a table (primary index)

  1. > SHOW EXPERIMENTAL_RANGES FROM TABLE credit_users;
  1. +-----------+---------+----------+----------+--------------+
  2. | start_key | end_key | range_id | replicas | lease_holder |
  3. +-----------+---------+----------+----------+--------------+
  4. | NULL | /5 | 158 | {2,3,5} | 5 |
  5. | /5 | /10 | 159 | {3,4,5} | 5 |
  6. | /10 | /15 | 160 | {2,4,5} | 5 |
  7. | /15 | NULL | 161 | {2,3,5} | 5 |
  8. +-----------+---------+----------+----------+--------------+
  9. (4 rows)

Show ranges for an index

  1. > SHOW EXPERIMENTAL_RANGES FROM INDEX credit_users@areaCode;
  1. +-----------+---------+----------+-----------+--------------+
  2. | start_key | end_key | range_id | replicas | lease_holder |
  3. +-----------+---------+----------+-----------+--------------+
  4. | NULL | /400 | 135 | {2,4,5} | 2 |
  5. | /400 | /600 | 136 | {2,4,5} | 4 |
  6. | /600 | /999 | 137 | {1,3,4,5} | 3 |
  7. | /999 | NULL | 72 | {2,3,4,5} | 4 |
  8. +-----------+---------+----------+-----------+--------------+
  9. (4 rows)

See also

Was this page helpful?
YesNo