Robert Haas <robertmh...@gmail.com> writes: > On Wed, Feb 29, 2012 at 2:08 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> I think you're just assuming that without any solid evidence. My point >> is precisely that if the more-parameterized path *fails* to generate >> fewer rows, we want add_path to notice that and throw it out (or at >> least be able to throw it out, if there's not another reason to keep it).
> Well, my "evidence" is that a parameterized path should pretty much > always include a paramaterized path somewhere in there - otherwise, > what is parameterization doing for us? Well, yes, we know that much. > And that's going to reduce the > row count. I may be missing something, but I'm confused as to why > this isn't nearly tautological. We don't know that --- I will agree it's likely, but that doesn't make it so certain that we can assume it without checking. A join condition won't necessarily eliminate any rows. (... thinks about that for awhile ...) One thing we could possibly do is have indxpath.c arbitrarily reject parameterizations that don't produce a smaller estimated number of rows than an unparameterized scan. Admittedly, this still doesn't *prove* the assumption for join relations, but maybe it brings the odds to where it's okay for add_path to make such an assumption. (... thinks some more ...) No, that doesn't get us there, because that doesn't establish that a more-parameterized path produces fewer rows than some path that requires less parameterization, yet not none at all. You really want add_path carrying out those comparisons. In your previous example, it's entirely possible that path D is dominated by B or C because of poor choices of join quals. 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