• Tom Lane's avatar
    New cost model for planning, incorporating a penalty for random page · b1577a7c
    Tom Lane authored
    accesses versus sequential accesses, a (very crude) estimate of the
    effects of caching on random page accesses, and cost to evaluate WHERE-
    clause expressions.  Export critical parameters for this model as SET
    variables.  Also, create SET variables for the planner's enable flags
    (enable_seqscan, enable_indexscan, etc) so that these can be controlled
    more conveniently than via PGOPTIONS.
    
    Planner now estimates both startup cost (cost before retrieving
    first tuple) and total cost of each path, so it can optimize queries
    with LIMIT on a reasonable basis by interpolating between these costs.
    Same facility is a win for EXISTS(...) subqueries and some other cases.
    
    Redesign pathkey representation to achieve a major speedup in planning
    (I saw as much as 5X on a 10-way join); also minor changes in planner
    to reduce memory consumption by recycling discarded Path nodes and
    not constructing unnecessary lists.
    
    Minor cleanups to display more-plausible costs in some cases in
    EXPLAIN output.
    
    Initdb forced by change in interface to index cost estimation
    functions.
    b1577a7c
orindxpath.c 7.68 KB