pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: David Geier <geidav.pg@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 00:21:36 -0500
Message-ID: <2130228.1668748896@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMbWs4_v47mP3VCoqo=7GjL59rDnYPDokCqjHKsJ+gbeRY4bqA@mail.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>

Richard Guo <guofenglinux@gmail.com> writes:
> Yes, it is.  Using zero flag would short-cut get_attstatsslot() to just
> return whether the slot type exists without loading it.  Do you think we
> need to emphasize this use case in the comments for 'flags'?

Perhaps, it's not really obvious now.

> I wonder whether we need to also check statistic_proc_security_check()
> when determining if MCVs exists in both sides.

Yeah, I thought about hoisting the statistic_proc_security_check
tests up into get_mcv_stats.  I don't think it's a great idea
though.  Again, it'd complicate untangling this if we ever
generalize the use of MCVs in this function.  Also, I don't
think we should be micro-optimizing the case where the security
check doesn't pass --- if it doesn't, you're going to be hurting
from bad plans a lot more than you are from some wasted cycles
here.

			regards, tom lane





view thread (13+ messages)  latest in thread

Message-ID: <2130228.1668748896@sss.pgh.pa.us>
Permalink:  ../2130228.1668748896@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2130228.1668748896@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, guofenglinux@gmail.com, tomas.vondra@enterprisedb.com, geidav.pg@gmail.com
  Subject: Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes
  In-Reply-To: <2130228.1668748896@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>

* 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