Mark Kirkwood <mark.kirkwood@xxxxxxxxxxxxxxx> writes: > While this is still fresh in your mind, a couple of additional anti join > queries are still managing to sneak past estimation: Yeah, those are estimating that all the outer rows have join partners, because there are more distinct values in the sub-select than there are in the outer relation. AFAICS there are not any errors in the statistics, it's just that the estimation rule falls down here. If you've heard of a better estimator for semijoin/antijoin selectivity, I'm all ears. The best idea I have at the moment is to put an arbitrary upper limit on the estimated selectivity, but that would be, well, arbitrary. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance