Re: Use extended statistics to estimate (Var op Var) clauses - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Use extended statistics to estimate (Var op Var) clauses
Date
Msg-id CAEZATCVFQw7bpv+YyQT+q+2VYMsXcSkwBL-MzQkjO==V+-HwiA@mail.gmail.com
Whole thread Raw
In response to Re: Use extended statistics to estimate (Var op Var) clauses  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Responses Re: Use extended statistics to estimate (Var op Var) clauses
List pgsql-hackers
On Mon, 13 Dec 2021 at 02:21, Tomas Vondra
<tomas.vondra@enterprisedb.com> wrote:
>
> Hi,
>
> I finally got around to this patch again, focusing mostly on the first
> part that simply returns either 1.0 or 0.0 for Var op Var conditions
> (i.e. the part not really using extended statistics).
>

Just starting to look at this again, starting with 0001 ...

This needs to account for nullfrac, since x = x is only true if x is not null.

I don't like how matching_restriction_variables() is adding a
non-trivial amount of overhead to each of these selectivity functions,
by calling examine_variable() for each side, duplicating what
get_restriction_variable() does later on.

I think it would probably be better to make the changes in
var_eq_non_const(), where all of this information is available, and
get rid of matching_restriction_variables() (it doesn't look like the
new scalarineqsel_wrapper() code really needs
matching_restriction_variables() - it can just use what
get_restriction_variable() already returns).

Regards,
Dean



pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: Making the subquery alias optional in the FROM clause
Next
From: Dean Rasheed
Date:
Subject: Re: Making the subquery alias optional in the FROM clause