mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Do execGrouping.c via expression eval machinery, take two.
This has a performance benefit on own, although not hugely so. The
primary benefit is that it will allow for to JIT tuple deforming and
comparator invocations.
Large parts of this were previously committed (773aec7aa
), but the
commit contained an omission around cross-type comparisons and was
thus reverted.
Author: Andres Freund
Discussion: https://postgr.es/m/20171129080934.amqqkke2zjtekd4t@alap3.anarazel.de
This commit is contained in:
@ -102,11 +102,12 @@ typedef struct AggStatePerTransData
|
||||
bool *sortNullsFirst;
|
||||
|
||||
/*
|
||||
* fmgr lookup data for input columns' equality operators --- only
|
||||
* set/used when aggregate has DISTINCT flag. Note that these are in
|
||||
* order of sort column index, not parameter index.
|
||||
* Comparators for input columns --- only set/used when aggregate has
|
||||
* DISTINCT flag. equalfnOne version is used for single-column
|
||||
* commparisons, equalfnMulti for the case of multiple columns.
|
||||
*/
|
||||
FmgrInfo *equalfns; /* array of length numDistinctCols */
|
||||
FmgrInfo equalfnOne;
|
||||
ExprState *equalfnMulti;
|
||||
|
||||
/*
|
||||
* initial value from pg_aggregate entry
|
||||
@ -270,7 +271,8 @@ typedef struct AggStatePerPhaseData
|
||||
int numsets; /* number of grouping sets (or 0) */
|
||||
int *gset_lengths; /* lengths of grouping sets */
|
||||
Bitmapset **grouped_cols; /* column groupings for rollup */
|
||||
FmgrInfo *eqfunctions; /* per-grouping-field equality fns */
|
||||
ExprState **eqfunctions; /* expression returning equality, indexed by
|
||||
* nr of cols to compare */
|
||||
Agg *aggnode; /* Agg node for phase data */
|
||||
Sort *sortnode; /* Sort node for input ordering for phase */
|
||||
|
||||
@ -290,7 +292,7 @@ typedef struct AggStatePerHashData
|
||||
TupleHashIterator hashiter; /* for iterating through hash table */
|
||||
TupleTableSlot *hashslot; /* slot for loading hash table */
|
||||
FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
|
||||
FmgrInfo *eqfunctions; /* per-grouping-field equality fns */
|
||||
Oid *eqfuncoids; /* per-grouping-field equality fns */
|
||||
int numCols; /* number of hash key columns */
|
||||
int numhashGrpCols; /* number of columns in hash table */
|
||||
int largestGrpColIdx; /* largest col required for hashing */
|
||||
|
Reference in New Issue
Block a user