Re: A Guide to Constraint Exclusion (Partitioning) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: A Guide to Constraint Exclusion (Partitioning)
Date
Msg-id 25487.1122139921@sss.pgh.pa.us
Whole thread Raw
In response to Re: A Guide to Constraint Exclusion (Partitioning)  (Greg Stark <gsstark@mit.edu>)
Responses Re: A Guide to Constraint Exclusion (Partitioning)
List pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> Note also that the index is only useful if the index is *being used*. And
> index scans are much slower than sequential scans.

You miss my point entirely: an indexscan that hasn't got to retrieve any
rows (because it has a constraint that points off the end of the index
range) is extremely fast, and the planner will reliably detect that and
use the index scan over a seqscan (assuming it has statistics showing
the range of indexed values).  And this decision is made separately for
each child table, so the fact that a seqscan might be the best bet for
the target partition doesn't stop the planner from using the indexscan
in other partitions.

However, Simon made a fair argument that there are useful cases where
you don't need an index on a partitioning key, so my objection is
answered.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: regressin failure on latest CVS
Next
From: Greg Stark
Date:
Subject: Re: A Guide to Constraint Exclusion (Partitioning)