Re: totally different plan when using partitions - Mailing list pgsql-general

From Scara Maccai
Subject Re: totally different plan when using partitions
Date
Msg-id 292963.52054.qm@web24601.mail.ird.yahoo.com
Whole thread Raw
In response to Re: totally different plan when using partitions  (Richard Huxton <dev@archonet.com>)
Responses Re: totally different plan when using partitions
List pgsql-general
Thank you for your reply.
This makes partitions unusable for me... hope someone explains why this happens... this still looks like a bug to me...
BTW the problem arises when adding the second "left outer join": when using only 1 partitioned table (that is, only 1
"leftouter join") the 2 plans are identical. 

My answers follow.

> Well, the first version was expecting about 400 rows, the
> second 15000, so it's not surprising that they have
> different plans.

Well, they're using exactly the same tables; I don't understand why one expects 400 rows and the other 15000....

> I'm not sure whether the planner is smart enough to cope
> with the multiple tests on time vs the partitioning and
> realise it can use your index on the partition.

Sorry, didn't understand that...

> I'm assuming the partition is defined as being "between
> '2006-10-01 00:00:00' and '2006-10-06 00:00:00'" - strikes
> me as an odd interval, and you don't say anywhere.

Data is partitioned on a "4 tables per month" basis

> You _might_ have a better plan by moving the partitioned
> tests into subqueries:
> FROM cell_bsc_60_0610 as cell_bsc
> left outer join (
>   SELECT ne_id FROM teststscell73 WHEREtime between
> '2006-10-01 00:00:00' and '2006-10-06 00:00:00') as data on
> data.ne_id=cell_bsc.nome1

Tried that, no changes.







pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: Help interpreting pg_stat_bgwriter output
Next
From: Richard Huxton
Date:
Subject: Re: totally different plan when using partitions