From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't read MCV stats needlessly in eqjoinsel().
Date: Fri, 18 Nov 2022 16:01:13 +0000
Message-ID: <E1ow3nl-000l5G-0y@gemulon.postgresql.org> (raw)
Don't read MCV stats needlessly in eqjoinsel().
eqjoinsel() currently makes use of MCV stats only when we have such
stats for both sides of the clause. As coded, though, it would
fetch those stats even when they're present for just one side.
This can be a bit expensive with high statistics targets, leading
to wasted effort in common cases such as joining a unique column
to a non-unique column. So it seems worth the trouble to do a quick
pre-check to confirm that both sides have MCVs before fetching either.
Also, tweak the API spec for get_attstatsslot() to document the
method we're using here.
David Geier, Tomas Vondra, Tom Lane
Discussion: https://postgr.es/m/b9846ca0-5f1c-9b26-5881-aad3f42b07f0@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f84ff0c6d4eb4e470e55f48103a7edd269d13c49
Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 20 ++++++++++++++++++--
src/backend/utils/cache/lsyscache.c | 4 ++++
2 files changed, 22 insertions(+), 2 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Don't read MCV stats needlessly in eqjoinsel().
In-Reply-To: <E1ow3nl-000l5G-0y@gemulon.postgresql.org>
References: <E1ow3nl-000l5G-0y@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox