Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 7 min read Release mediumAdept

pg_clickhouse 0.11.1: Now with pgvector, UPDATE, DELETE pushdown

pg_clickhouse 0.11.1 maps pgvector's vector type to ClickHouse Array(Float32/Float64) columns. It pushes pgvector distance operators down to ClickHouse functions such as L2Distance and cosineDistance, and reports in EXPLAIN whether a ClickHouse vector_similarity HNSW index applies. It also pushes UPDATE and DELETE down as ClickHouse lightweight updates and deletes on MergeTree tables, along with TRUNCATE; lightweight updates need block number/offset settings enabled and suit changes to under about 10% of a table. Other changes include regr_* aggregate pushdown, OrNull aggregates that match Postgres NULL semantics, JSONB subscript pushdown, session timezone alignment, and Decimal(76,38) for unconstrained numeric.

Related posts

  • Introducing pg_clickhouse: A Postgres extension for querying ClickHouse

    ClickHouse mediumAdept

    pg_clickhouse v0.1.0 is an Apache 2-licensed PostgreSQL foreign data wrapper, derived from clickhouse_fdw, that runs analytics queries on ClickHouse from Postgres so existing queries can work unmodified by changing search_path. It modernizes the code with PGXS builds, CI across PostgreSQL 13-18 and ClickHouse 22-25, TLS, and Bool/Decimal/JSON types. Its main advance is pushdown: ordered-set aggregates like percentile_cont() are rewritten to ClickHouse quantile() and FILTER clauses become -If combinators. SEMI JOIN pushdown plus planner cost tuning brought 21 of 22 TPC-H queries under 1s, with 12 fully pushed down.

  • pg_clickhouse & chdb updates: Encoding, nesting, and types

    ClickHouse mediumAdept

    pg_clickhouse v0.11.0 and the chdb extension v0.1.2 improve Postgres–ClickHouse type compatibility. A new `check_encoding` option (fail, remove, replace, truncate) handles invalidly encoded text, and ClickHouse Interval types now import as Postgres `interval` with pushdown of expressions like `start_at + duration`. Parameterized JSON columns map to jsonb so `ORDER BY` on a property pushes down correctly, and unflattened Nested columns map to 2-D text arrays or to matching composite-type arrays. The release also adds mappings for large integers, geo and time types, pushes down the sha*/digest functions, removes `clickhouse_raw_query()` and drops PostgreSQL 13 support.

  • What's New in pg_clickhouse - JSONB Support, SQL value functions, Streaming, and more

    ClickHouse mediumAdept

    pg_clickhouse, the Postgres foreign data wrapper for querying ClickHouse, now pushes down far more operations to ClickHouse. JSONB accessors (->, ->>, jsonb_extract_path) are translated to ClickHouse sub-column syntax. CURRENT_DATE, CURRENT_TIMESTAMP and clock_timestamp() are translated to ClickHouse now()/now64()/nowInBlock64 calls that use the Postgres session time zone and timestamp precision. Array functions now map to their ClickHouse equivalents. Streaming of HTTP driver results in roughly 50MB batches kept container memory under about 100MiB during a full NYC taxi table scan, versus about 600MiB without it.

  • What's new in pg_clickhouse v0.10.0: Subqueries, TPC-H Speedups, C Driver, and Aggregates

    ClickHouse hardMaster

    pg_clickhouse v0.10.0 pushes correlated scalar subqueries, IN and NOT IN down to ClickHouse as remote subqueries and anti/semi-joins, raising full TPC-H pushdown from 12 to 16 of 22 queries. Q17 drops from 32.7 s to 37 ms, beating native PostgreSQL's 2.1 s. A NULL-semantics layer tracks how each expression's result is consumed and injects CASE guards only when operands may be NULL, so ClickHouse's two-valued IN matches PostgreSQL's three-valued logic; transform_null_in is pinned to 0 so a server profile can't break those guards. The release also switches from clickhouse-cpp to the plain-C clickhouse-c driver, which fixes setjmp/longjmp-vs-exception crashes and streams results, and gives each concurrent foreign scan its own connection. Statistical, ordered-set and partitionwise aggregates now push down, and builtin function pushdown is opt-in to preserve Postgres semantics.

  • ClickHouse and PostgreSQL - a Match Made in Data Heaven - part 1

    ClickHouse mediumAdept

    ClickHouse can query PostgreSQL data in place through the postgresql table function and the PostgreSQL table engine. Simple WHERE clauses are pushed down to Postgres, while aggregation, joins, sorting and LIMIT run in ClickHouse. On the 28M-row UK house price dataset, a low-selectivity filter makes Postgres choose a parallel sequential scan over the index, taking about 28s, and querying through ClickHouse gives similar times because Postgres still does the scan. Queries using ClickHouse-specific functions such as toYear are not pushed down and can run much slower. Rewriting joins with conditional aggregates like medianIf, or copying the data into local MergeTree tables, is what delivers the large speedups.

The quest for software engineering knowledge.

Look:
Layout: