don't allocate HashAgg hash tables when running explain only

From: Alexey Bashtanov <bashtanov(at)imap(dot)cc>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: don't allocate HashAgg hash tables when running explain only
Date: 2020-11-13 16:10:30
Message-ID: 36823f65-050d-ae24-aa4d-a37726998240@imap.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I got somewhat scared when my explain took a few seconds to complete and
used a few gigs of RAM.
To reproduce try the following:

discard temp;
create temp table a as select to_timestamp(generate_series(1, 7000)) i;
analyze a;
set work_mem to '3GB';
explain select distinct a1.i - a2.i from a a1, a a2;

I would appreciate if someone could have a look at the patch attached,
which makes executor skip initializing hash tables when doing explain only.

Best, Alex

Attachment Content-Type Size
dont-build-agg-hashtable-on-explain-only-v1.diff text/x-patch 652 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-11-13 16:26:21 Re: Strange behavior with polygon and NaN
Previous Message Justin Pryzby 2020-11-13 16:00:07 error_severity of brin work item