psql or your favorite client.
Step 1. Create a sample table and seed data
The following SQL creates a transactionalorders table and inserts a few rows for testing.
Step 2. Route queries through DuckDB
Enable the DuckDB execution engine for the current session. With this single GUC, all supported queries automatically run on the vectorized engine.Step 3. Run analytical queries
Aggregate revenue by product
Aggregate revenue by day
Real analytical workload example
For a more realistic benchmark, seed asales_log fact table with three million synthetic transactions and then route a complex window query through DuckDB.
Create the transactional table
Insert 3 million sample rows
Benchmark the window-heavy query
-
Run with PostgreSQL’s executor (default)
Leaveduckdb.force_executionunset (or explicitlySET duckdb.force_execution = false;) and execute the analytical query below. Record the elapsed time fromEXPLAIN ANALYZE. -
Enable DuckDB and rerun
Turn on DuckDB for the current session and immediately run the same SQL again to compare results:
sales_log row-store table, grouping three million rows into 10,000 user partitions, applying a moving average window, filtering anomalies, and sorting the top 100 largest deviations:
| Executor | duckdb.force_execution | Runtime observed |
|---|---|---|
| PostgreSQL | false (default) | ~5.8 seconds |
| DuckDB engine | true | ~1.5 second |
Key benefits
- Seamless integration: Works with existing PostgreSQL SQL and tooling.
- High performance: Vectorized execution with automatic parallelism for scans and aggregations.
- Zero friction: A single session parameter (
duckdb.force_execution) controls the engine.
Operational tips
Automatic fallback
If a statement includes features not supported by DuckDB, Relyt automatically falls back to the default PostgreSQL executor. No manual intervention is required.Inspect the execution engine
UseEXPLAIN to verify whether DuckDB handled the query: