Abu Mushayeed <abumushayeed(at)yahoo(dot)com> writes:
> I really could appreciate some help.
If nothing else, "set enable_hashagg = off" should help. But have you
analyzed these tables lately? Perhaps you have work_mem set too high?
regards, tom lane