Skip to content

Commit 81baae6

Browse files
authored
Common subexpression elimination in columnar agg (#9534)
1) Use interning to find the identical expression subtrees and replace them with a canonical pointer. 1) Count how many times each expression is present in the hierarchy. 1) For expression that are present many times, compute them only once per batch.
1 parent 67a3858 commit 81baae6

13 files changed

Lines changed: 1156 additions & 50 deletions

.unreleased/columnar-cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implements: #9534 Speed up expression evaluation in the columnar pipeline by caching common subexpressions

src/compat/compat.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,23 @@ RestrictSearchPath(void)
304304
0,
305305
false);
306306
}
307+
308+
/*
309+
* murmurhash64 was added to common/hashfn.h in PG17 (954e43564d9).
310+
*/
311+
static inline uint64
312+
murmurhash64(uint64 data)
313+
{
314+
uint64 h = data;
315+
316+
h ^= h >> 33;
317+
h *= 0xff51afd7ed558ccd;
318+
h ^= h >> 33;
319+
h *= 0xc4ceb9fe1a85ec53;
320+
h ^= h >> 33;
321+
322+
return h;
323+
}
307324
#endif
308325

309326
#if PG17_LT

0 commit comments

Comments
 (0)