Robert Haas <robertmh...@gmail.com> writes: > I think it would be a good idea, as Thomas says, to order the qual > clauses at an earlier stage and then remember our decision. However, > we have to think about whether that's going to increase planning time > in a noticeable way. I wonder why we currently postpone this until > such a late phase of planning.
Because (1) up to now there's been no need to consider the qual ordering till later, and (2) re-doing that sort for each path seemed unduly expensive. If we're to try to estimate whether later quals will be reached, then sure the ordering becomes important. I'm still concerned about (2) though. If there were a way to pre-sort the quals once for all paths, the problem goes away, but I don't think that works --- indexscans may segregate some quals, and in join cases different paths will actually have different sets of quals they need to check depending on the join order. So the bottom line here is how much is it going to cost us to add this additional refinement in cost estimation, and is it worth it given our extremely poor level of accuracy in expression cost estimation. Color me dubious. 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