Home / Market / duckdb analytics

duckdb analytics

Query, aggregate, and transform Parquet, Arrow, and Polars datasets with DuckDB. Verify Hive partition pruning, tune memory spill limits, and isolate worker cursors.

skill★ 508060 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: duckdb-analytics description: "Query, aggregate, and transform Parquet, Arrow, and Polars datasets with DuckDB. Verify Hive partition pruning, tune memory spill limits, and isolate worker cursors." category: data risk: safe source: self source_type: self date_added: "2026-11-30" author: ShianMike tags: [duckdb, parquet, arrow, polars, analytics, sql]

---

DuckDB Analytics

When to Use

Prerequisites

Identify the DuckDB version (duckdb.__version__ or SELECT version()), host language binding, available RAM and scratch disk, and input file layout (single files, glob patterns, or Hive-partitioned directories). Inspect how connections, cursors, and registered DataFrames are shared across threads, and confirm read-only vs write access before attaching persistent .duckdb files or writing Parquet output.

Verify partition and filter pushdown

  1. Pass explicit options such as hive_partitioning = true and union_by_name = true (only when schema drift across files is expected) to read_parquet. Bind query paths and filter values with positional ($1) or named ($region) parameters instead of interpolating untrusted strings into SQL.
  2. Run EXPLAIN (FORMAT JSON) before executing expensive aggregations over large directory globs (avoid matching exact boxed ASCII line wrapping, which varies across DuckDB releases). Inspect the READ_PARQUET operator's extra_info to confirm File Filters and Scanning Files show partition pruning and that row-level predicates appear as Filters inside READ_PARQUET rather than only after a full scan.
  3. Project only the columns required by the query. Avoid SELECT * on wide Parquet datasets, since DuckDB's columnar reader skips unreferenced column chunks.

Exchange DataFrames cleanly and isolate cursors

Bound memory, spill disk, and file writes

Example

> Query a Hive-partitioned Parquet order dataset, prove DuckDB prunes unneeded partition files, and join Polars DataFrames across isolated cursors without extra Arrow copies.

Run the worked Parquet and Polars test to verify EXPLAIN file pruning (Scanning Files: 2/4), zero-warning sql(..., params=...).pl() output, and cursor-local registration isolation.

Limitations

Safety and Side Effects

Inspect file globs and output paths before running COPY ... TO. Use read_only = True when inspecting existing .duckdb files, avoid loading unreviewed third-party community extensions, and never interpolate untrusted user input into SQL strings or file paths. Keep credentials out of query strings and logs.

Related Skills and Documentation