Re: A Guide to Constraint Exclusion (Partitioning)
Greg Stark <gsstark@mit.edu>
From: Greg Stark <gsstark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Stark <gsstark@mit.edu>, Simon Riggs <simon@2ndquadrant.com>, bizgres-general@pgfoundry.org, pgsql-hackers@postgresql.org
Date: 2005-07-23T18:27:24Z
Lists: pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> 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.
That was the detail I was missing. I'm surprised because I actually tested
this before I sent the message and saw a plan like this with a single
sequential scan node despite the three child tables:
staging=> explain select * from _test where a=1;
QUERY PLAN
------------------------------------------------------
Seq Scan on _test (cost=0.00..22.50 rows=5 width=4)
Filter: (a = 1)
(2 rows)
[This is on 7.4, maybe the 8.0 plans are more explicit though I don't recall
any mention of changes in that area]
--
greg