Re: A Guide to Constraint Exclusion (Partitioning)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <gsstark@mit.edu>
Cc: Simon Riggs <simon@2ndquadrant.com>, bizgres-general@pgfoundry.org, pgsql-hackers@postgresql.org
Date: 2005-07-23T17:32:01Z
Lists: 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