Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51ad5b9

Browse files
committed
jit: Re-allow JIT compilation of execGrouping.c hashtable comparisons.
In the course of5567d12,356687b and317ffdf, I changedBuildTupleHashTable[Ext]'s call to ExecBuildGroupingEqual to not passin the parent node, but NULL. Which in turn prevents the tupleequality comparator from being JIT compiled. While that fixesbug #15486, it is not actually necessary after all of the above commits,as we don't re-build the comparator when using the newBuildTupleHashTableExt() interface (as the content of the hashtableare reset, but the TupleHashTable itself is not).Therefore re-allow jit compilation for callers that useBuildTupleHashTableExt with a separate context for "metadata" andcontent.As in the previous commit, there's ongoing work to make this easier totest to prevent such regressions in the future, but thatinfrastructure is not going to be backpatchable.The performance impact of not JIT compiling hashtable equalitycomparators can be substantial e.g. for aggregation queries thataggregate a lot of input rows to few output rows (when there are a lotof output groups, there will be fewer comparisons).Author: Andres FreundDiscussion:https://postgr.es/m/20190927072053.njf6prdl3vb7y7qb@alap3.anarazel.deBackpatch: 11, just as5567d12
1 parent51e3005 commit51ad5b9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/backend/executor/execGrouping.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ BuildTupleHashTableExt(PlanState *parent,
164164
TupleHashTablehashtable;
165165
Sizeentrysize=sizeof(TupleHashEntryData)+additionalsize;
166166
MemoryContextoldcontext;
167+
boolallow_jit;
167168

168169
Assert(nbuckets>0);
169170

@@ -206,11 +207,21 @@ BuildTupleHashTableExt(PlanState *parent,
206207
*/
207208
hashtable->tableslot=MakeSingleTupleTableSlot(CreateTupleDescCopy(inputDesc));
208209

210+
/*
211+
* If the old reset interface is used (i.e. BuildTupleHashTable, rather
212+
* than BuildTupleHashTableExt), allowing JIT would lead to the generated
213+
* functions to a) live longer than the query b) be re-generated each time
214+
* the table is being reset. Therefore prevent JIT from being used in that
215+
* case, by not providing a parent node (which prevents accessing the
216+
* JitContext in the EState).
217+
*/
218+
allow_jit=metacxt!=tablecxt;
219+
209220
/* build comparator for all columns */
210221
hashtable->tab_eq_func=ExecBuildGroupingEqual(inputDesc,inputDesc,
211222
numCols,
212223
keyColIdx,eqfuncoids,
213-
NULL);
224+
allow_jit ?parent :NULL);
214225

215226
/*
216227
* While not pretty, it's ok to not shut down this context, but instead

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp