ivy_duckdb Use Cases and User Guide

Use ivy_duckdb for reporting, aggregations, and ad hoc analysis on existing IvorySQL row-store tables. Applications continue writing to those tables while analytics sessions can send supported queries to DuckDB. If you need a continuously synchronized Iceberg columnstore mirror, see the ivy_mooncake user guide.

1. Set up the extension

Choose an ivy_duckdb build that matches your IvorySQL version. After installing the extension files, add pg_duckdb to shared_preload_libraries in postgresql.conf, keep the existing entries, and restart the instance.

CREATE EXTENSION IF NOT EXISTS pg_duckdb;

Create the extension in the database where you will run reports. To authorize an analytics role to use DuckDB, configure duckdb.postgres_role as appropriate for your deployment and grant the role access to the required tables.

2. Verify DuckDB execution on a row-store query

See the tested Oracle-mode example. It runs EXPLAIN (COSTS OFF) for the same grouped query on htap_ora_source in one session. With duckdb.force_execution off, the plan shows HashAggregate and Seq Scan. With it on, the plan shows Custom Scan (DuckDBScan).

For timing, see the two-million-row comparison. Before using the extension in production, compare results and performance on representative queries, especially those using Oracle-compatible types, implicit conversions, or specialized functions.

3. Manage analytics sessions

  • Start by enabling duckdb.force_execution in a dedicated analytics session, then reset the setting when finished.

  • For concurrent analytics sessions, review DuckDB memory and thread settings per connection.

  • If a query fails, record the SQL, data types, and plan. For a standard row-store query, turn off duckdb.force_execution and run the same SQL through IvorySQL for comparison.

See the ivy_duckdb technical design for the execution path and compatibility boundaries.