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

From Greg Stark
Subject Re: A Guide to Constraint Exclusion (Partitioning)
Date
Msg-id 874qalbcoj.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: A Guide to Constraint Exclusion (Partitioning)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: A Guide to Constraint Exclusion (Partitioning)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: A Guide to Constraint Exclusion (Partitioning)
Next
From: Bruce Momjian
Date:
Subject: Re: For review: Server instrumentation patch