Open-Source Wikis

/

DuckDB

/

Extensions

/

Other in-tree extensions

duckdb/duckdb

Other in-tree extensions

A short tour of the smaller in-tree extensions: autocomplete, TPC-H, TPC-DS, jemalloc, delta, demo_capi, and loader.

autocomplete

extension/autocomplete/ powers the SQL autocomplete used by the DuckDB CLI shell. It is a self-contained suggestion engine that knows about:

  • SQL keywords (driven by the same data the parser uses).
  • Identifiers visible in the catalog.
  • Built-in and registered function names.
  • Common SQL patterns ("after SELECT, suggest column expressions then FROM").

The CLI calls into it via the C API to populate linenoise-style completion lists. See extension/autocomplete/CMakeLists.txt and the tools/cli-shell page.

tpch

extension/tpch/ registers the TPC-H schema and a data generator:

INSTALL tpch;
LOAD tpch;
CALL dbgen(sf=1);          -- generate scale factor 1
SELECT * FROM tpch_queries(); -- list canonical queries
PRAGMA tpch(1);            -- run query #1

It bundles the official TPC-H reference query texts (extension/tpch/dbgen/) and a port of the TPC-H data generator. Used by BUILD_TPCH=1 make for benchmark builds and by the test suite for regression checks (test/sql/tpch/).

tpcds

extension/tpcds/ is the TPC-DS counterpart. It provides:

INSTALL tpcds;
LOAD tpcds;
CALL dsdgen(sf=1);
PRAGMA tpcds(1);

The vendored sources live in extension/tpcds/dsdgen/. Several queries are skipped or rewritten where SQL features have moved between TPC-DS revisions; the differences are documented in extension/tpcds/README.md.

Both tpch and tpcds populate the schema as base tables, so subsequent queries are run against real DuckDB tables.

jemalloc

extension/jemalloc/ ships a vendored jemalloc allocator. When loaded, it replaces the default allocator. On Linux, jemalloc generally improves throughput for write-heavy workloads and reduces fragmentation in long-running processes; on macOS the system allocator is usually fine.

Build with:

DUCKDB_EXTENSIONS=jemalloc make
# or
BUILD_JEMALLOC=1 make

Implementation: a thin wrapper that replaces Allocator::DefaultAllocator (src/common/allocator.cpp) with the jemalloc-backed implementation at extension load.

delta

extension/delta/ is an in-tree wrapper around the delta-kernel-rs Rust library. It exposes a read_delta table function that reads Delta Lake tables (transaction-aware reads with snapshot isolation, deletion vectors, schema evolution).

Most of the implementation lives in the delta-kernel-rs Rust sources fetched at build time; the in-tree code in extension/delta/ is the DuckDB-side glue (table function bind, scan, schema inference). Building requires Rust:

DUCKDB_EXTENSIONS=delta make

demo_capi

extension/demo_capi/ is a documentation-only example: a minimal extension implemented entirely through the C API. It is what extension/README.md references for "how do I write an out-of-tree extension?" It is not loaded by default and exists purely as a working sample.

loader

extension/loader/ is a build-time-only helper that emits the C ABI entry point an extension needs in order to be loadable as a shared library. It does not register any SQL functions. Other extensions depend on it during their build so they all share the same ABI shim.

See also

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Other in-tree extensions – DuckDB wiki | Factory