Log Message: ----------- Fix some planner issues found while investigating Kevin Grittner's report of poorer planning in 8.3 than 8.2: 1. After pushing a constant across an outer join --- ie, given "a LEFT JOIN b ON (a.x = b.y) WHERE a.x = 42", we can deduce that b.y is sort of equal to 42, in the sense that we needn't fetch any b rows where it isn't 42 --- loop to see if any additional deductions can be made. Previous releases did that by recursing, but I had mistakenly thought that this was no longer necessary given the EquivalenceClass machinery. 2. Allow pushing constants across outer join conditions even if the condition is outerjoin_delayed due to a lower outer join. This is safe as long as the condition is strict and we re-test it at the upper join. 3. Keep the outer-join clause even if we successfully push a constant across it. This is *necessary* in the outerjoin_delayed case, but even in the simple case, it seems better to do this to ensure that the join search order heuristics will consider the join as reasonable to make. Mark such a clause as having selectivity 1.0, though, since it's not going to eliminate very many rows after application of the constant condition. 4. Tweak have_relevant_eclass_joinclause to report that two relations are joinable when they have vars that are equated to the same constant. We won't actually generate any joinclause from such an EquivalenceClass, but again it seems that in such a case it's a good idea to consider the join as worth costing out. 5. Fix a bug in select_mergejoin_clauses that was exposed by these changes: we have to reject candidate mergejoin clauses if either side was equated to a constant, because we can't construct a canonical pathkey list for such a clause. This is an implementation restriction that might be worth fixing someday, but it doesn't seem critical to get it done for 8.3. Modified Files: -------------- pgsql/src/backend/optimizer/path: equivclass.c (r1.8 -> r1.9) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/equivclass.c?r1=1.8&r2=1.9) joinpath.c (r1.114 -> r1.115) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/joinpath.c?r1=1.114&r2=1.115) orindxpath.c (r1.83 -> r1.84) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/orindxpath.c?r1=1.83&r2=1.84) pathkeys.c (r1.92 -> r1.93) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/pathkeys.c?r1=1.92&r2=1.93) pgsql/src/backend/optimizer/plan: initsplan.c (r1.137 -> r1.138) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/initsplan.c?r1=1.137&r2=1.138) pgsql/src/include/nodes: relation.h (r1.152 -> r1.153) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.152&r2=1.153) pgsql/src/test/regress/expected: join.out (r1.32 -> r1.33) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/join.out?r1=1.32&r2=1.33) join_1.out (r1.14 -> r1.15) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/join_1.out?r1=1.14&r2=1.15) pgsql/src/test/regress/sql: join.sql (r1.23 -> r1.24) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/join.sql?r1=1.23&r2=1.24)
pgsql-committers by date:
Соглашаюсь с условиями обработки персональных данных