INFORMATION_SCHEMA
INFORMATION_SCHEMA is Lakehouse's built-in metadata query interface, based on the ANSI SQL-92 standard. It lets you query metadata such as tables, views, job history, and permissions using standard SQL, with no additional tools required.
Contents
| Page | Description |
|---|---|
| Instance-level INFORMATION_SCHEMA | Instance-level metadata across workspaces; requires INSTANCE ADMIN permission; accessed via SYS.information_schema |
| Workspace-level INFORMATION_SCHEMA | Metadata for tables, views, job history, etc. in the current workspace; requires the workspace_admin role |
Two Access Scopes
| Scope | Access Path | Permission Required | Typical Use |
|---|---|---|---|
| Instance-level | SYS.information_schema.<view_name> | INSTANCE ADMIN | View metadata across all workspaces; view records of deleted objects |
| Workspace-level | information_schema.<view_name> | workspace_admin | View table schemas, job history, and permission assignments in the current workspace |
Choosing Between INFORMATION_SCHEMA and SHOW / DESC
| Scenario | Recommended Approach | Notes |
|---|---|---|
| View real-time status of a single object | SHOW / DESC | Returns results immediately; suitable for checking current state of tables, columns, clusters, and jobs |
| Aggregate statistics or cross-object analysis | information_schema | Supports standard SQL with JOIN, GROUP BY, ORDER BY |
| View deleted objects | Instance-level SYS.information_schema or SHOW TABLES HISTORY | Instance-level views use delete_time to identify deleted objects |
| Cost analysis | SYS.information_schema.instance_usage / storage_metering | Includes CRU, storage, network, and other billing fields |
| File deduplication and tracking for imports | load_history('schema.table') | View COPY/Pipe file import history; retained for 7 days |
Common Queries
View all tables in the current workspace
View job history (last 24 hours)
View all tables across the instance (requires INSTANCE ADMIN)
Asset Inventory SQL
View all schemas in the current workspace
View all tables with size and row count
View detailed column information
View sort key recommendations
Find the 10 largest tables
Find tables without comments
Find columns without comments
Count tables and total storage per schema
View all workspaces in the instance (requires INSTANCE ADMIN)
View all schemas in the instance (requires INSTANCE ADMIN)
View instance usage (requires INSTANCE ADMIN)
Notes
- View data has approximately a 15-minute delay; for real-time metadata use commands such as
SHOW TABLESandSHOW JOBS - All views are read-only and cannot be modified or deleted
- Avoid
SELECT *in scheduled tasks; specify explicit columns to prevent errors caused by view schema changes - Deleted objects in instance-level views are retained for 60 days; use
delete_time IS NULLto filter for existing objects
Related Documentation
| Document | Description |
|---|---|
| Instance-level INFORMATION_SCHEMA Overview | Access methods, usage restrictions, and query examples for instance-level views |
| Instance-level INFORMATION_SCHEMA View List | Field descriptions for all instance-level views |
| Workspace-level INFORMATION_SCHEMA Overview | Permission requirements, usage notes, and query examples for workspace-level views |
| Workspace-level INFORMATION_SCHEMA View List | Field descriptions for all workspace-level views |
| Analyzing Job History with job_history | Practical guide for analyzing resource usage and performance bottlenecks using the job_history view |
| Permission Inventory and Optimization Best Practices | Inventory and optimize permission configurations using views such as object_privileges, roles, and users |
| Security Compliance Audit Guide | Complete solution for compliance auditing (e.g., ISO 27001, SOC 2) using information_schema |
| Billing Anomaly Analysis and Troubleshooting | Analyze billing anomalies using the instance_usage and storage_metering views |
