Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, tomas(at)vondra(dot)me, vignesh C <vignesh21(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning
Date: 2025-03-28 16:46:15
Message-ID: CAExHW5ufwK=7UgegeQVVjewiZqGaY6CsA+5ht1OpO_yS0EkHBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 28, 2025 at 12:01 PM Ashutosh Bapat
<ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> Comparing root->join_rel_hash with EC->ec_derives_hash in the context
> of initial hash table size is a thinko on my part. It's less likely
> that there will be 1000 subqueries (requiring 1000 PlannerInfos) each
> with more than 32 join rels than a query with 1000 equivalence classes
> in one PlannerInfo with more than 32 ec_derives. So if using a small
> initial hash table doesn't impact performance negatively, why not save
> some memory. Thinking more about it, we know the size of
> ec_derives_list when creating the hash table and we are using
> simplehash which uses its own fillfactor and its own logic to expand
> the hash table, I think we should just use the length of
> ec_derives_list as the initial size. What do you think?
>

PFA patches. 0001 and 0002 are the same as the previous set. 0003
changes the initial hash table size to the length of ec_derives.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
0001-Add-assertion-to-verify-derived-clause-has--20250328.patch text/x-patch 1.5 KB
0002-Make-derived-clause-lookup-in-EquivalenceCl-20250328.patch text/x-patch 25.5 KB
0003-Use-length-of-ec_derives-clause-list-as-ini-20250328.patch text/x-patch 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2025-03-28 17:16:29 Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning
Previous Message Robert Haas 2025-03-28 16:42:48 Re: Proposal: Progressive explain