Hi Mario,

I reviewed CF 7310 v1
Improve hash aggregate spilling by writing only the needed columns [1]

The approach looks useful. The compact spill layout and 
direct re-spilling fit the existing executor design.

Initial Run
===========

The patch applies cleanly. Automated testing used macOS arm64 and
Apple Clang 21. No compiler warnings or correctness failures were
observed.

Performance
===========

My local tests supported the spill-performance improvements.

* At SF1 the query does not spill, so this shows that in-memory path is
not affected.

I found a small startup cost in a different non-spilling case:
repeated aggregation over an empty, wide table. Across 10,000
executions, this measured 509 ms on master versus 535 ms with v1.

The attached follow-up initializes the compact layout on the first
actual spill. It allocates in es_query_cxt to survive resets and
rescans. This restored the startup result to 510 ms.

Nitpicking & Conclusion
=======================

Nit: A brief comment explaining that the reconstructed input slot
borrows Datums from the compact spill slot would help document
ownership.

The patch adds no regression tests. Coverage for sparse-column
reconstruction, NULL/by-reference values, recursive spilling, mixed
grouping sets and rescans would be helpful.

The attached lazy implementation is one tested option. Please feel
free to incorporate or adapt it.

Attachments:

- CF-7310-lazy-initialization.patch
  Applies on top of v1; for discussion.

Regards,
Ethan

[1] CF 7310 v1, 2026-09-17, Improve hash aggregate spilling by writing only the needed columns

Attachment: CF-7310-lazy-initialization.patch
Description: Binary data

Reply via email to