Kaloyan Iliev Iliev <news1@faith.digsys.bg> writes:
> It worked. I have read in the docs what this "enable_hashagg" do, but I
> couldn't understand it. What does it change?
Your original 7.4 query plan has several HashAgg steps in it, which are
doing aggregate/GROUP BY operations. The planner thinks that they will
use only nominal amounts of memory because there are only a few distinct
groups in each case. Evidently that is wrong and at least one of them
is dealing with so many groups as to run out of memory. So the next
question is have you ANALYZEd all of these tables recently?
I wouldn't recommend turning off hashagg as a permanent solution, it
was just a quickie to verify my suspicion of where the memory was going.
regards, tom lane