Re: Estimates not taking null_frac element into account with @@ operator? (8.4 .. git-head) - Mailing list pgsql-hackers

From Jesper Krogh
Subject Re: Estimates not taking null_frac element into account with @@ operator? (8.4 .. git-head)
Date
Msg-id 4D5DA2AB.7020202@krogh.cc
Whole thread Raw
In response to Re: Estimates not taking null_frac element into account with @@ operator? (8.4 .. git-head)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Estimates not taking null_frac element into account with @@ operator? (8.4 .. git-head)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2011-02-17 23:20, Tom Lane wrote:
> Jesper Krogh<jesper@krogh.cc>  writes:
>> When something evaluates to "null" isn't included in the result,
>> shouldn't the query-planner
>> then take the null_frac into account when computing the estimate?
> The proposed patch seems wrong to me: if we're estimating on the basis
> of most-common-value fractions, the null_frac is already accounted for,
> because it's not part of the MCV selectivity fractions.  IOW, aren't you
> double-counting the null fraction?
It might be the wrong place to fix, but here it seems like we're only
counting MCE-freqs based on non-null elements:


http://git.postgresql.org/gitweb?p=postgresql.git;a=blob;f=src/backend/tsearch/ts_typanalyze.c;h=2654d644579fd1959282d83919474f42540ca703;hb=HEAD#l396

And the testdata confirms the behaviour.

-- 
Jesper



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Estimates not taking null_frac element into account with @@ operator? (8.4 .. git-head)
Next
From: Tom Lane
Date:
Subject: ALTER TYPE COLLATABLE?