+ linkend="geqo" endterm="geqo-title"> when the number of joins
+ exceeds a threshold (see ).
the index's operator class>, another plan is created using
the B-tree index to scan the relation. If there are further indexes
present and the restrictions in the query happen to match a key of an
- index further plans will be considered.
+ index, further plans will be considered. Index scan plans are also
+ generated for indexes that have a sort ordering that can match the
+ query's ORDER BY> clause (if any), or a sort ordering that
+ might be useful for merge joining (see below).
- After all feasible plans have been found for scanning single relations,
- plans for joining relations are created. The planner/optimizer
- preferentially considers joins between any two relations for which there
- exist a corresponding join clause in the WHERE qualification (i.e. for
- which a restriction like where rel1.attr1=rel2.attr2
- exists). Join pairs with no join clause are considered only when there
- is no other choice, that is, a particular relation has no available
- join clauses to any other relation. All possible plans are generated for
- every join pair considered
- by the planner/optimizer. The three possible join strategies are:
+ If the query requires joining two or more relations,
+ plans for joining relations are considered
+ after all feasible plans have been found for scanning single relations.
+ The three available join strategies are:
cheapest one.
+ If the query uses fewer than
+ relations, a near-exhaustive search is conducted to find the best
+ join sequence. The planner preferentially considers joins between any
+ two relations for which there exist a corresponding join clause in the
+ WHERE qualification (i.e. for
+ which a restriction like where rel1.attr1=rel2.attr2
+ exists). Join pairs with no join clause are considered only when there
+ is no other choice, that is, a particular relation has no available
+ join clauses to any other relation. All possible plans are generated for
+ every join pair considered by the planner, and the one that is
+ (estimated to be) the cheapest is chosen.
+
+
+ When geqo_threshold is exceeded, the join
+ sequences considered are determined by heuristics, as described
+ in . Otherwise the process is the same.
+
+
The finished plan tree consists of sequential or index scans of
the base relations, plus nested-loop, merge, or hash join nodes as