]> granicus.if.org Git - postgresql/commit
Unbreak Finalize HashAggregate over Partial HashAggregate.
authorRobert Haas <rhaas@postgresql.org>
Fri, 16 Dec 2016 15:03:08 +0000 (10:03 -0500)
committerRobert Haas <rhaas@postgresql.org>
Fri, 16 Dec 2016 15:03:08 +0000 (10:03 -0500)
commitb81b5a96f424531b97cdd1dba97d9d1b9c9d372e
tree9f2a42bcb7413185777dfae93163794838d47211
parent6a4fe1127c5a0ea1515589e416aa29e088170c0e
Unbreak Finalize HashAggregate over Partial HashAggregate.

Commit 5dfc198146b49ce7ecc8a1fc9d5e171fb75f6ba5 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
src/backend/executor/execGrouping.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeRecursiveunion.c
src/backend/executor/nodeSetOp.c
src/backend/executor/nodeSubplan.c
src/include/executor/executor.h
src/include/nodes/execnodes.h