Re: Table Partitioning, Part 1

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Table Partitioning, Part 1
Date: 2005-05-10 06:00:49
Message-ID: 87ekcfsjqm.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> > Partition Elimination relies upon being able to prove at execution time
>
> You mean plan time.

Fwiw, both are possible.

In oracle there are (at least) three different cases:

1. For queries like "select * from tab" the plan shows a multiple partition
scan.

2. For queries like "select * from tab where partition_key = 1" the plan
shows the partition that the planner proved would suffice.

3. For queries like select * from tab where partition_key = ?" the plan
shows a single partition scan of a partition to be determined at run-time.

This last case can be very important for joins as well. For queries like
select * from tab,tab2 where tab1.partition_key = tab2.fk" the planner can
prove that each nested loop iteration will only require a single btree lookup.
This is important since if it can't prove this the nested loop has to do
multiple index lookups making it look very poor compared to a merge join or
hash join.

There are also cases where Oracle knows that the plan node will involve
reading multiple partitions but not all.

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2005-05-10 06:37:21 Re: request for sql3 compliance for the update command
Previous Message Josh Berkus 2005-05-10 04:59:51 Re: Views, views, views! (long)