Observability into DuckDB storage internals at the database, table, and column levels
Maintainer(s):
Andrewtangtang,
dentiny
Installing and Loading
INSTALL table_inspector FROM community;
LOAD table_inspector;
Example
-- List all attached persistent databases with file sizes
SELECT * FROM inspect_storage();
-- List all tables with their persisted data size
SELECT * FROM inspect_database();
-- Per-segment storage details for a specific column
SELECT * FROM inspect_column('my_table', 'my_column');
-- High-level storage breakdown
SELECT * FROM inspect_block_usage();
About table_inspector
A DuckDB extension that provides observability into DuckDB storage internals. It helps users understand storage usage at the database, table, and column levels, and addresses issues like unexpected file size or poor compression.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| inspect_storage | table | List all attached persistent databases with file and WAL sizes | Returns database_name, database_file_bytes, and wal_file_bytes for each non-system, non-temporary, non-in-memory attached database | [SELECT * FROM inspect_storage();] |
| inspect_database | table | List all tables with persisted data and index sizes | Calculates data size by counting unique persistent block IDs per table, and index size from ART allocator buffers | [SELECT * FROM inspect_database();] |
| inspect_column | table | Show per-segment storage details for a column | Returns row_group_id, compression type, compressed_bytes, estimated_decompressed_bytes, and row_count for each segment | [SELECT * FROM inspect_column('mytable', 'mycolumn');] |
| inspect_block_usage | table | Show storage breakdown by component | Breaks down a .duckdb file into table_data, index, metadata, and free_blocks with size_bytes, percentage, and block_count | [SELECT * FROM inspect_block_usage();] |
Overloaded Functions
| function_name | function_type | description | comment | examples | |—————|—————|————-|———|———-|
Added Types
| type_name | type_size | logical_type | type_category | internal | |———–|———-:|————–|—————|———-|
Added Settings
| name | description | input_type | scope | aliases | |——|————-|————|——-|———|