whether is there any sql statement which can list the descriptor ID of all tables and databases ? I want get all the descriptor ID and their relation.
HI @yangliang9004,
Are you asking for specific table_ids
and database_ids
? If so you can run
select * from system.crdb_internal.tables;
This will give you a list of all your tables with an ID, a parent_id, which is also the id of the database, and the name of the table, and the database it belongs to.
Let me know if you have any other questions.
Thanks,
Ron
Note that the crdb_internal
interface is experimental and subject to change without notice, i.e. you can’t build tooling upon it and expect it to remain stable.
Instead in CockroachDB 2.2/19.1 you can use pg_catalog.pg_tables
where the oid
of the object will also be the descriptor ID.