public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tomas Vondra <[email protected]>
To: Zhihong Yu <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: using extended statistics to improve join estimates
Date: Thu, 7 Oct 2021 00:05:39 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CALNJ-vRTL-5qjYrNEDkS=xg_mbDT6y98XGgD8jrJzcPLRSMSuw@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<CALNJ-vRTL-5qjYrNEDkS=xg_mbDT6y98XGgD8jrJzcPLRSMSuw@mail.gmail.com>

On 10/6/21 23:03, Zhihong Yu wrote:
> Hi,
> 
> +       conditions2 = statext_determine_join_restrictions(root, rel, mcv);
> +
> +       /* if the new statistics covers more conditions, use it */
> +       if (list_length(conditions2) > list_length(conditions1))
> +       {
> +           mcv = stat;
> 
> It seems conditions2 is calculated using mcv, I wonder why mcv is 
> replaced by stat (for conditions1 whose length is shorter) ?
> 

Yeah, that's wrong - it should be the other way around, i.e.

     if (list_length(conditions1) > list_length(conditions2))

There's no test with multiple candidate statistics yet, so this went 
unnoticed :-/


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





view thread (11+ messages)  latest in thread

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]
  Subject: Re: using extended statistics to improve join estimates
  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