On Mon, 13 Dec 2021 at 02:21, Tomas Vondra <tomas.von...@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