Environment
- YugabyteDB Managed- All Versions
Issue
Customers who don’t have direct access to the database nodes (i.e. who can’t use yb-admin to connect to the masters directly) may still want to know how many tablets there are for a table with just database-level access.
Resolution
YSQL
- The following query gives the tablet count in YSQL.
SELECT * FROM yb_table_properties('table_name'::regclass);
- An example is given below.
yugabyte=> SELECT * FROM yb_table_properties('dept'::regclass);
num_tablets | num_hash_key_columns | is_colocated | tablegroup_oid | colocation_id
------------+----------------------+--------------+----------------+---------------
1 | 0 | f | |
(1 row)
YCQL
- In YCQL, the tablet count appears in the output of DESCRIBE if it was specified during table creation. An example is given below.
cassandra@ycqlsh:desctest> CREATE TABLE cyclist_alt_stats ( id UUID PRIMARY KEY, lastname text, birthday timestamp, nationality text, weight text, height text ) WITH TABLETS=17; cassandra@ycqlsh:desctest> DESC TABLE cyclist_alt_stats CREATE TABLE desctest.cyclist_alt_stats ( id uuid PRIMARY KEY, lastname text, birthday timestamp, nationality text, weight text, height text ) WITH default_time_to_live = 0 AND tablets = 17 AND transactions = {'enabled': 'false'};
Comments
0 comments
Please sign in to leave a comment.