public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Richard Guo <[email protected]>
Cc: Ilia Evdokimov <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Remove vardata parameters from eqjoinsel_inner
Date: Thu, 27 Mar 2025 09:40:16 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMbWs49ybFS2UPhm4veuTPJw8ZTsrjjXYQgE9Pi5neC2XvOrbg@mail.gmail.com>
References: <[email protected]>
	<CAMbWs49ybFS2UPhm4veuTPJw8ZTsrjjXYQgE9Pi5neC2XvOrbg@mail.gmail.com>

Richard Guo <[email protected]> writes:
> On Fri, Feb 21, 2025 at 7:04 PM Ilia Evdokimov
> <[email protected]> wrote:
>> When calculating selectivity for an inner equijoin, we call
>> eqjoinsel_inner, which uses unused parameters vardata1 and vardata2.
>> These parameters might have been left behind accidentally when we moved
>> getting sslots out of the function. I suggest removing them, as they can
>> be added back at any time if needed. I attached patch with fixes.

> Yeah, these parameters haven't been used since a314c3407, when we
> moved get_variable_numdistinct and get_attstatsslot out of
> eqjoinsel_inner and eqjoinsel_semi to avoid repetitive information
> lookup when we call both eqjoinsel_inner and eqjoinsel_semi.

> I'm wondering whether we should also remove parameter vardata1 from
> eqjoinsel_semi.  vardata2 is still needed though to clamp nd2 to be
> not more than the rel's row estimate.

I do not believe this change is worth the code churn.  In the first
place, we may well need those values again someday.  In the second
place, the savings would be negligible.  (In fact, since
eqjoinsel_inner probably gets inlined at its sole call site, the
savings would likely be completely nonexistent.)  If the caller
could avoid calculating the vardata info at all, that would be
worth thinking about, but I think it can't.

			regards, tom lane





view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Remove vardata parameters from eqjoinsel_inner
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox