marko@joh.to writes:
> This seems to be because neqsel() doesn't take at all into account that both
> operators will exclude NULL rows, and does a simple 1.0 - eqsel().
Yeah, that's clearly broken. A localized fix would be to re-fetch the
nullfrac statistic and subtract it off, but that seems pretty inefficient.
I'd be inclined to refactor things so that eqsel() and neqsel() call a
common routine that takes a "bool negate" argument, about like the way the
patternsel() functions work, and then the common routine could handle
the nullfrac correctly for both cases.
Hmm ... actually, I think patternsel() is broken for this case too ---
it has the information to do the right thing, but it doesn't look like
it actually is doing it:return negate ? (1.0 - result) : result;
should be more likereturn negate ? (1.0 - result - nullfrac) : result;
neqjoinsel has a similar issue, and I'm not sure what else.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs