GitHub user igor-suhorukov added a comment to the discussion: [Proposal] Apache 
Cloudberry as PostgreSQL 19 Extensions

@leborchuk thanks! I'm coming back to the ClickBench part now that there are 
numbers.

> PG is not good enough to beat clickhouse in clickbench … mainly because 
> clickhouse constantly compact (sort) data in background

Agreed. So instead of competing with MergeTree, I put MergeTree inside 
PostgreSQL:

- [ch_table_engines](https://github.com/igor-suhorukov/pg_ch_table_engines) 
runs ClickHouse's own MergeTree family (v26.8 LTS, linked from its sources and 
not copied) as PostgreSQL 19 table access methods. Background merge workers 
sort and merge the parts. PostgreSQL keeps MVCC, WAL, indexes, replicas and 
pg_dump.
- [pg_vexec](https://github.com/igor-suhorukov/pg_vexec) reads those columns in 
1,024-row batches. This is where the GROUP BY work you mention lives: 
vectorized aggregation partitioned in shared memory across parallel workers, 
and grouping by dictionary on LowCardinality columns.
- Neither needs a core patch, so there is no kernel to rebase for them. The 
same library also runs on the pg19 port of Cloudberry, on one node and on a 
cluster. Each segment keeps and merges its own parts.

ClickBench, 10M rows, same laptop, geometric mean of hot runs 
([write-up](https://igor-suhorukov.github.io/blog/2026/10/21/my-postgresql-is-faster-than-yours/)):

|                                             | geomean | vs ClickHouse |
| ------------------------------------------- | ------: | ------------: |
| PostgreSQL 19, heap                         | 715 ms  | ~39×          |
| PostgreSQL 19 + ch_table_engines + pg_vexec | 49.9 ms | ~3×           |
| ClickHouse 26.9                             | 16.8 ms | 1×            |

That isn't beating ClickHouse yet. Most of the remaining gap is fixed per-query 
cost: backend planning and starting parallel workers. The light queries are 
4–18× slower (Q1, Q19), but the heavy GROUP BY queries are within 1.4–1.9× 
(Q20, Q28, Q33). This is one host and 10M rows. Multi-host and 100M-row runs 
are still to do.

I'd prefer to keep the standard ClickBench, with answers checked against 
DuckDB, over writing our own benchmark. I'm happy to open a separate discussion 
on bringing this to Cloudberry.

GitHub link: 
https://github.com/apache/cloudberry/discussions/2065#discussioncomment-19092936

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to