Re: A Guide to Constraint Exclusion (Partitioning)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, bizgres-general(at)pgfoundry(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: A Guide to Constraint Exclusion (Partitioning)
Date: 2005-07-23 17:32:01
Message-ID: 25487.1122139921@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-07-23 17:32:30 Re: [HACKERS] O_DIRECT for WAL writes
Previous Message Bruce Momjian 2005-07-23 17:15:12 Re: [HACKERS] regressin failure on latest CVS