DuckLake Metadata Store Monitoring

DuckLake separates table metadata from table data. Metadata lives in a DuckDB database (or PostgreSQL, or MySQL), and data lives as Parquet files on object storage. When you query a DuckLake table, two distinct I/O paths activate — one to the metadata store for schema resolution, and one to object storage for row data. The standard DuckDB query metrics capture both, but interpreting them requires understanding which path each metric reflects. This post covers how DuckDB’s profiler metrics behave with DuckLake, what to watch for in a deployed metadata store, and which ratios signal trouble.

The Two I/O Paths

When DuckDB executes a query against a DuckLake catalog, the execution pipeline looks like this:

1
2
3
4
5
6
7
SQL Query
    ↓
DuckLake Catalog  →  resolve table metadata from metadata DB
    ↓
Parquet Reader    →  read data files from object storage (S3/GCS/Azure)
    ↓
DuckDB Engine     →  filter, join, aggregate (same as native tables)

The metadata store is accessed during the planner phase. The Parquet data files are accessed during the execution phase. Each phase shows up in different metrics.

How Each Metric Behaves with DuckLake

latency and cpu_time

With local DuckDB tables, cpu_time / latency is typically 0.7 to 0.95 — most wall-clock time is spent in operators. With DuckLake, expect a large gap. The difference is network I/O wait time for object storage reads.

If cpu_time / latency is below 0.1, the query is I/O-bound on remote storage. The operators finish their work quickly, but the overall query waits on network round-trips to fetch Parquet data.

cpu_time does not include network wait because operator timers only run while the operator is actively processing data. When a scan operator blocks waiting for an S3 response, the timer is paused.

total_bytes_read

This is the key metric for DuckLake cost monitoring. It captures bytes read via FileHandle::Read() from any filesystem — local, S3, httpfs, Azure. For DuckLake queries, this includes both Parquet file reads from object storage and reads of the metadata database.

Use it to estimate costs:

  • S3 GET request pricing scales with the number of reads
  • Data transfer / egress fees scale with total_bytes_read

cumulative_rows_scanned

Reported by the Parquet reader’s scan function, just like native table scans. The count reflects rows after Parquet row-group pruning and predicate pushdown. DuckLake stores min/max statistics per row group, and the Parquet reader uses them to skip irrelevant groups.

If rows_scanned is much less than the table’s total row count, pruning is working. If it equals the total, either the predicate does not align with row-group boundaries or the column has poor sort order for the filter.

system_peak_buffer_memory

Same sampling mechanism as native tables, but buffer memory may be higher with remote storage. DuckDB caches more aggressively to avoid re-fetching from the network. Parquet page caches and decompression buffers contribute here.

system_peak_temp_dir_size

Large DuckLake queries that exceed memory still spill to the local temp directory. The spill path is local — DuckDB does not spill to object storage. If you are running in a pod, the spill volume must be local (emptyDir or attached SSD).

total_bytes_written

For DuckLake writes (INSERT, COPY INTO), this captures bytes written to Parquet files on object storage. This directly maps to S3 PUT request size. If bytes_written seems too high, check if you are writing unnecessary columns.

Write-path metrics

write_to_wal_latency, checkpoint_latency, and commit_local_storage_latency all apply to the metadata database, not to the Parquet data files. Parquet files are immutable — no WAL or checkpoint is needed for them.

If the metadata database is remote (e.g., PostgreSQL), these metrics include network latency to the metadata store. A spike in checkpoint_latency means the metadata DB is slow to flush, not that object storage is slow.

The Critical Metric: planner.binding_time

planner.binding_time measures how long the planner spends resolving table names, column names, and types against the catalog. For local DuckDB storage, binding is fast — the catalog is in-process memory. For DuckLake, binding requires reading metadata from the catalog database.

If the metadata DB is remote, planner.binding_time includes network round-trips to resolve table schemas, column types, and statistics. This is the metric that separates DuckLake monitoring from native DuckDB monitoring.

1
2
3
4
5
6
7
8
9
10
11
12
13
PRAGMA enable_profiling = 'json';
PRAGMA profiling_mode = 'detailed';
PRAGMA profiling_output = '/tmp/ducklake_metrics.json';

ATTACH 'ducklake:metadata.ducklake' AS lake;
USE lake;

SELECT sensor_id, AVG(temperature), COUNT(*)
FROM remote_measurements
WHERE temperature > 50
GROUP BY sensor_id
ORDER BY COUNT(*) DESC
LIMIT 10;

Then inspect the binding time:

1
2
3
4
5
6
7
jq '{
  latency:      .latency,
  binding_time: .planner_binding_time,
  planner_time: .planner_total_time,
  cpu_time:     .cpu_time,
  bytes_read:   .total_bytes_read
}' /tmp/ducklake_metrics.json

What the ratio tells you

planner.binding_time / planner.total_time tells you what fraction of planning is metadata access. Locally this is near 100% — binding is essentially all of planning. With DuckLake, the absolute value matters more than the ratio because it contains network latency.

Watch for these patterns:

Pattern Diagnosis
binding_time > 100 ms Metadata DB is slow or remote — consider co-locating
binding_time grows with query complexity Each table/subquery triggers catalog lookups — simplify joins or use materialized views
binding_time spikes intermittently Network instability or metadata DB connection pool exhaustion

Monitoring Checklist for DuckLake Deployments

I/O cost

Track total_bytes_read per query and aggregate over time. This is your primary lever for object storage cost control. Column pruning (selecting only needed columns) is the most effective way to reduce it — Parquet columnar format means unselected columns are never read from storage.

Network vs compute ratio

Track cpu_time / latency per query. A ratio below 0.1 means the query is network-bound. Options:

  • Co-locate compute with storage (same region)
  • Pre-aggregate frequently queried data
  • Use partition pruning to reduce the number of Parquet files scanned

Metadata overhead

Track planner.binding_time per query. If it represents a significant fraction of latency (say, more than 10% for short-running queries), the metadata store is a bottleneck. Options:

  • Co-locate the metadata DB with the compute pods
  • Reduce the number of tables resolved per query
  • Use simpler schemas — fewer columns and fewer nested types mean fewer catalog lookups

Memory and spill

Track system_peak_buffer_memory and system_peak_temp_dir_size. With DuckLake, buffer memory tends to run higher due to caching of remote Parquet pages. Spill still goes to local disk. Make sure the pod has adequate emptyDir volume for spill, separate from the metadata DB storage.

Write cost

For DuckLake writes, track total_bytes_written — this is the volume of Parquet data pushed to object storage. Also track write_to_wal_latency and commit_local_storage_latency — these reflect the metadata DB write path. If commit latency is high, the bottleneck is metadata persistence, not data file creation.

Putting It Together

A complete DuckLake monitoring view tracks metrics from both I/O paths:

Metric Source What it tells you
latency Full query End-to-end cost including network
cpu_time Operators Compute work only
latency - cpu_time Derived Network wait + overhead
total_bytes_read FileHandle Object storage transfer volume
total_bytes_written FileHandle Object storage write volume
rows_scanned Parquet reader Effectiveness of row-group pruning
peak_buffer_memory Buffer pool Memory pressure (higher with caching)
peak_temp_dir_size Buffer manager Spill indicator
planner.binding_time Planner Metadata store latency
commit_local_storage_latency Transaction Metadata write path

The gap between latency and cpu_time is the single most important signal for DuckLake. It tells you how much of the query’s wall-clock time is spent waiting on the network. Everything else follows from narrowing that gap — column pruning, partition pruning, co-location, and metadata caching all reduce it.