Re: proposal : cross-column stats

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tv@fuzzy.cz>
Cc: Florian Pflug <fgp@phlo.org>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, Martijn van Oosterhout <kleptog@svana.org>, pgsql-hackers@postgresql.org
Date: 2010-12-13T15:34:50Z
Lists: pgsql-hackers
Tomas Vondra <tv@fuzzy.cz> writes:
> 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).

If you can solve the AND case, the OR case falls out of that.  Just
replace s1*s2 with a more accurate AND calculation.

			regards, tom lane