Re: proposal : cross-column stats

Tomas Vondra <tv@fuzzy.cz>

From: Tomas Vondra <tv@fuzzy.cz>
To: Florian Pflug <fgp@phlo.org>
Cc: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, Martijn van Oosterhout <kleptog@svana.org>, pgsql-hackers@postgresql.org
Date: 2010-12-13T02:08:54Z
Lists: pgsql-hackers
> P(A|B) = P(A and B) / P(B).

Well, until this point we've discussed failure cases involving 'AND'
conditions. What about 'OR' conditions? I think the current optimizer
computes the selectivity as 's1+s2 - s1*s2' (at least that's what I
found in backend/optimizer/path/clausesel.c:630).

Sometimes that may return nearly 2x the actual selectivity, but in
general it's a reasonable estimate. Are there any severe failure cases
that produce much worse estimates?

regards
Tomas