I wrote: > Tomas Vondra <tomas.von...@2ndquadrant.com> writes: >> Is this a good idea? I'd probably vote to do what's proposed (and >> rejected) in the second half of the comment, i.e. put back the clauses >> and skip the FK as that pretty much says "improve estimate or keep the >> current one, but don't risk making it worse."
> I would buy that approach when it comes to "loose" quals, but I think > it's not right for EC-derived matches, because of the behavior we > discussed previously that an EC should be considered to have implicitly > generated all the matching quals even though it actually made only one > qual that might not be any of them exactly. After further thought I decided you're right, because one of the main original goals of ECs was to prevent double-counting the selectivity of redundant equality quals. Acting as though the EC had generated multiple redundant quals is likely to make things worse not better. I still feel that we're leaving something on the table here, but it would need to take the form of intelligently combining estimates for overlapping FKs, not just blindly multiplying them together. Seems like a task for later, especially considering that cases of this sort are likely to be rare. Pushed with adjustments for that. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers