Skip to main content

Schema Inspection

CamusDB supports SQL inspection commands for databases, tables, columns, indexes, query plans, and node-local engine metrics.

Databases

SHOW DATABASES;
SHOW DATABASE;
SHOW ORPHAN DATABASES;
SHOW BRANCHES FROM prod;
SHOW ANCESTORS FROM feature_checkout;

SHOW DATABASES lists registered databases. SHOW DATABASE reports the current database context and its database comment, if one is set.

SHOW BRANCHES FROM <database> lists every branch below a database, including branches of branches. It returns the descendant database name, stable internal id, depth, immediate parent, and fork timestamp.

SHOW ANCESTORS FROM <database> walks the other direction: it returns the queried database's parent chain, starting with the immediate parent. Root databases return an empty result set.

SHOW ORPHAN DATABASES lists dropped root databases that are still recoverable. Use the returned id with CREATE DATABASE ... RELINK TO.

Grants

SHOW GRANTS;
SHOW GRANTS FOR myapp;

SHOW GRANTS lists the current authenticated user's grants. SHOW GRANTS FOR lists grants for a named user and requires superuser privileges. See Authentication And Authorization.

Tables And Columns

SHOW TABLES;
SHOW ORPHAN TABLES;
SHOW COLUMNS FROM robots;
DESCRIBE robots;
DESC robots;
SHOW CREATE TABLE robots;

SHOW ORPHAN TABLES lists dropped tables in the current database that are still recoverable. Use the returned id with CREATE TABLE ... RELINK TO.

SHOW CREATE TABLE includes table, column, and secondary-index comments, so it is the preferred inspection command when you need schema descriptions. See Schema Comments.

See Recover Dropped Objects for the recovery workflow and retention settings.

Indexes

SHOW INDEXES FROM robots;
SHOW INDEX FROM robots;

SHOW INDEXES includes any covering-index payload columns in the Include column. SHOW CREATE TABLE renders INCLUDE (...) for inline and standalone covering indexes so the DDL can be replayed.

Explain

Inspect a plan with EXPLAIN:

EXPLAIN SELECT * FROM robots WHERE year = 2024;
EXPLAIN (LOGICAL) SELECT * FROM robots WHERE year = 2024;
EXPLAIN (PHYSICAL) SELECT * FROM robots WHERE year = 2024;
EXPLAIN (ANALYZE) SELECT * FROM robots WHERE year = 2024 LIMIT 5;

See Explaining Queries And Commands for output details.

Engine Stats

Inspect node-local Kahuna and Kommander engine metrics with:

SHOW ENGINE STATS;
SHOW ENGINE STATS LIKE 'raft.executor%';

SHOW ENGINE STATS does not require a selected database. When authentication is enabled, it requires a superuser because it exposes node-level workload, Raft, WAL, and storage signals.

See Engine Stats for result columns, filtering, and configuration.

Analyze

Refresh planner statistics for a table with ANALYZE:

ANALYZE robots;
ANALYZE TABLE robots;

ANALYZE rebuilds table statistics used by the cost model, including histograms and distinct-value counts. See Query Planning and Automatic Analyze.