SHOW DATABASES returns metadata for every database visible to the current role, with optional filters such as LIKE, STARTS WITH, and row limits.
SHOW DATABASES displays metadata for every database your current role can see. The result set includes created_on, name, owner, comment, and retention_time. It never affects data, so it's safe for quick checks or automation scripts.
Run SHOW DATABASES;
while using any warehouse. The command returns every database—like ECOMMERCE
, ANALYTICS
, and FINANCE
—that your role can access. Sort or filter the result in the UI, or pipe it to a client-side script for automation.
Add the LIKE
or STARTS WITH
clause. For instance, SHOW DATABASES LIKE 'ECOM%';
returns only databases whose names begin with ECOM
. This is handy in multi-tenant setups.
Combine SHOW DATABASES
with RESULT_SCAN
on the last query: SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID())) WHERE owner='MY_ROLE';
This keeps the inventory focused on what you administer.
Use TERSE
to reduce columns when building dashboards. Always apply filters in large accounts to avoid hitting the 10,000-row cap. Incorporate result-set queries instead of exporting CSVs to automate audits.
Missing warehouse: You still need an active warehouse session even though the command is metadata-only. Resume or switch to a tiny warehouse to avoid costs.
Relying on stale UI: Refresh the worksheet or rerun the command; Snowflake does not auto-refresh browser tabs after DDL operations.
Only the minimal compute to start a warehouse. Query duration is short, so cost is negligible on an X-SMALL warehouse.
No. An active warehouse is required even for metadata queries.
Use CREATE TABLE db_inv AS SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));
right after running the command.
No. Snowflake stores unquoted identifiers in uppercase, so SHOW DATABASES LIKE 'ecom%'
matches ECOMMERCE
.
Only if your current role has the global MONITOR USAGE
privilege or specific privileges on those databases.
Wrap the command in a stored procedure or task that captures the RESULT_SCAN output into a history table for compliance.