Returns per-table storage statistics from the DuckLake catalog: how many Parquet data files each table has and their total size, plus the same for delete files.
Arguments
- table_name
Optional table name, optionally qualified as
"schema.table". When provided, only that table's row is returned (a bare name matches it in every schema).- ducklake_name
Name of the attached DuckLake catalog. If
NULL, the current database is used.- conn
Optional DuckDB connection object. If not provided, uses the default ducklake connection.
Value
A data frame with one row per table and columns table_name,
schema_id, table_id, table_uuid, file_count, file_size_bytes,
delete_file_count, delete_file_size_bytes, and schema_name.
Details
These statistics are the raw material for storage maintenance decisions:
many small files are worth compacting with merge_adjacent_files(), and a
growing delete-file share is a sign to run rewrite_data_files(). Rows
that are still inlined in the catalog (see set_inlining_row_limit()) are
not in any Parquet file yet, so small recent writes may not show up in the
counts until flush_inlined_data() writes them out.
This wraps DuckLake's ducklake_table_info() function.
See also
plot_table_files(), merge_adjacent_files(),
rewrite_data_files()
Other maintenance:
backup_ducklake(),
checkpoint_ducklake(),
cleanup_old_files(),
delete_orphaned_files(),
expire_snapshots(),
flush_inlined_data(),
list_ducklake_files(),
merge_adjacent_files(),
plot_table_files(),
rewrite_data_files()
Examples
lake_dir <- tempfile("info_lake_")
dir.create(lake_dir)
attach_ducklake("info_lake", lake_path = lake_dir)
create_table(mtcars, "cars")
# File statistics for every table in the lake
get_table_info()
#> table_name schema_id table_id table_uuid file_count
#> 1 cars 0 1 01a0b152-c6c8-74e9-9858-8654fcf7b722 1
#> file_size_bytes delete_file_count delete_file_size_bytes schema_name
#> 1 2911 0 0 main
# Just one table
get_table_info("cars")
#> table_name schema_id table_id table_uuid file_count
#> 1 cars 0 1 01a0b152-c6c8-74e9-9858-8654fcf7b722 1
#> file_size_bytes delete_file_count delete_file_size_bytes schema_name
#> 1 2911 0 0 main
detach_ducklake("info_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)
