pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Geier <geidav.pg@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes
Date: Fri, 18 Nov 2022 11:07:18 -0500
Message-ID: <2233221.1668787638@sss.pgh.pa.us> (raw)
In-Reply-To: <2a4917f7-8a4d-0094-7189-3a6dcaebad44@gmail.com>
References: <b9846ca0-5f1c-9b26-5881-aad3f42b07f0@gmail.com>
	<522124.1668179795@sss.pgh.pa.us>
	<16acb727-24e8-6453-1711-aae339802966@gmail.com>
	<2f30ba9c-b707-55ae-0afd-68eb6a8a7708@enterprisedb.com>
	<2067066.1668731970@sss.pgh.pa.us>
	<2106238.1668735410@sss.pgh.pa.us>
	<CAMbWs4_v47mP3VCoqo=7GjL59rDnYPDokCqjHKsJ+gbeRY4bqA@mail.gmail.com>
	<2130228.1668748896@sss.pgh.pa.us>
	<712310f5-a5c7-b833-4f71-b562c5f2de9b@gmail.com>
	<53950f93-8cce-4440-52f1-5879653c6803@enterprisedb.com>
	<2a4917f7-8a4d-0094-7189-3a6dcaebad44@gmail.com>

David Geier <geidav.pg@gmail.com> writes:
> On 11/18/22 14:00, Tomas Vondra wrote:
>> Seems fine. I wonder if we could/could introduce a new constant for 0,
>> similar to ATTSTATSSLOT_NUMBERS/ATTSTATSSLOT_VALUES, instead of using a
>> magic constant. Say, ATTSTATSSLOT_NONE or ATTSTATSSLOT_CHECK.

> Good idea. I called it ATTSTATSSLOT_EXISTS. New patch attached.

No, I don't think it's a good idea.  The flags argument is documented as,
and used as, a bitmask of multiple options.  Passing zero fits fine with
that and is consistent with what we do elsewhere.  Turning it into
sort-of-an-enum-but-not-really isn't an improvement.

I didn't like your draft comment too much, because it didn't cover
what I think is the most important point: after a call with flags=0
we do not need a matching free_attstatsslot call to avoid leaking
anything.  (If we did, this patch would be a lot hairier.)

I rewrote the comment the way I wanted it and pushed.

			regards, tom lane





view thread (13+ messages)

Message-ID: <2233221.1668787638@sss.pgh.pa.us>
Permalink:  ../2233221.1668787638@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2233221.1668787638@sss.pgh.pa.us

 · 

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 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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, geidav.pg@gmail.com, tomas.vondra@enterprisedb.com, guofenglinux@gmail.com
  Subject: Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes
  In-Reply-To: <2233221.1668787638@sss.pgh.pa.us>
  References: <b9846ca0-5f1c-9b26-5881-aad3f42b07f0@gmail.com> <522124.1668179795@sss.pgh.pa.us> <16acb727-24e8-6453-1711-aae339802966@gmail.com> <2f30ba9c-b707-55ae-0afd-68eb6a8a7708@enterprisedb.com> <2067066.1668731970@sss.pgh.pa.us> <2106238.1668735410@sss.pgh.pa.us> <CAMbWs4_v47mP3VCoqo=7GjL59rDnYPDokCqjHKsJ+gbeRY4bqA@mail.gmail.com> <2130228.1668748896@sss.pgh.pa.us> <712310f5-a5c7-b833-4f71-b562c5f2de9b@gmail.com> <53950f93-8cce-4440-52f1-5879653c6803@enterprisedb.com> <2a4917f7-8a4d-0094-7189-3a6dcaebad44@gmail.com> <2233221.1668787638@sss.pgh.pa.us>

* 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