Returns information about the Parquet files backing each table, including file counts, sizes, and row counts. Use this to identify tables that would benefit from compaction.
Indicators that compaction may help:
High file count with small average file size (< 10 MB)
Many more files than expected for the data volume
Slow query performance on tables with many files
Value
A data.frame with columns:
schema_name: Schema containing the tabletable_name: Table namefile_count: Number of Parquet filestotal_rows: Total row count across all filestotal_bytes: Total size in bytesavg_file_bytes: Average file sizeavg_rows_per_file: Average rows per file
See also
db_compact() to merge small files
Examples
if (FALSE) { # \dontrun{
db_connect()
# Check all tables
db_file_stats()
# Check a specific table
db_file_stats(table = "imports")
# Find tables needing compaction (many small files)
stats <- db_file_stats()
stats[stats$file_count > 100 & stats$avg_file_bytes < 1e7, ]
} # }