Search Postgresql Archives

Re: totally different plan when using partitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Scara Maccai wrote:

> explain analyze
> 	select nome1, 
> 	thv3tralacc, 
> 	dltbfpgpdch
> 	FROM cell_bsc_60_0610 as cell_bsc
> 		left outer join teststscell73_0610_1 as data on data.ne_id=cell_bsc.nome1
> 		left outer join teststscell13_0610_1 as data1 on data1.ne_id=cell_bsc.nome1 and data1.time=data.time  
> 	where 
> 
> 	data.time >=cell_bsc.starttime and data.time <=cell_bsc.endtime and	
> 	 data.time between '2006-10-01 00:00:00' and '2006-10-06 00:00:00' 
> and	data1.time >=cell_bsc.starttime and data1.time <=cell_bsc.endtime 
> 	 and	data1.time between '2006-10-01 00:00:00' and '2006-10-06 00:00:00' 
> 	and cell_bsc.nome2=2
> 
> explain analyze:
> 
> http://explain-analyze.info/query_plans/3805-query-plan-2509
> 
> 
> same query, but using postgresql's partition pruning ("2"):
> 
> explain analyze
> 	select nome1, 
> 	thv3tralacc, 
> 	dltbfpgpdch
> 	FROM cell_bsc_60_0610 as cell_bsc
> 		left outer join teststscell73 as data on data.ne_id=cell_bsc.nome1
> 		left outer join teststscell13 as data1 on data1.ne_id=cell_bsc.nome1 and data1.time=data.time  
> 	where 
> 
> 	data.time >=cell_bsc.starttime and data.time <=cell_bsc.endtime and	
> 	 data.time between '2006-10-01 00:00:00' and '2006-10-06 00:00:00' 
> and	data1.time >=cell_bsc.starttime and data1.time <=cell_bsc.endtime 
> 	 and	data1.time between '2006-10-01 00:00:00' and '2006-10-06 00:00:00' 
> 	and cell_bsc.nome2=2

Huh, clearly not the same query (you're using the partition directly in
the first query) ...  Doing two changes at once is not helping your
case.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux