1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Unbreak Finalize HashAggregate over Partial HashAggregate.

Commit 5dfc198146 introduced the use
of a new type of hash table with linear reprobing for hash aggregates.
Such a hash table behaves very poorly if keys are inserted in hash
order, which does in fact happen in the case where a query use a
Finalize HashAggregate node fed (via Gather) by a Partial
HashAggregate node.  In fact, queries with this type of plan tend
to run effectively forever.

Fix that by seeding the hash value differently in each worker
(and in the leader, if it participates).

Andres Freund and Robert Haas
This commit is contained in:
Robert Haas
2016-12-16 10:03:08 -05:00
parent 6a4fe1127c
commit b81b5a96f4
7 changed files with 30 additions and 8 deletions

View File

@ -510,7 +510,8 @@ buildSubPlanHash(SubPlanState *node, ExprContext *econtext)
nbuckets,
0,
node->hashtablecxt,
node->hashtempcxt);
node->hashtempcxt,
false);
if (!subplan->unknownEqFalse)
{
@ -529,7 +530,8 @@ buildSubPlanHash(SubPlanState *node, ExprContext *econtext)
nbuckets,
0,
node->hashtablecxt,
node->hashtempcxt);
node->hashtempcxt,
false);
}
/*