Query:
set enable_mergejoin=off;set enable_hashjoin=off;
explain analyze
select nome1,
thv3tralacc,
dltbfpgpdch
FROM cell_bsc_60_0610 as cell_bsc
left outer join teststscell73_test as data on data.ne_id=cell_bsc.nome1
left outer join teststscell13_test 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-02 01: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-02 01:00:00'
and cell_bsc.nome2=2;
Explain analyze on my sistem ("PostgreSQL 8.4.0 on sparc-sun-solaris2.10, compiled by cc: Sun C 5.9 SunOS_sparc Patch
124867-022007/11/27, 64-bit"):
http://explain-analyze.info/query_plans/3822-query-plan-2528
interesting bit (if I got it right):
-> Nested Loop (cost=0.0..3139.65 rows=6531 width=36) (actual time=0.141..13.459 rows=3692 loops=1)
Join Filter: ((data1.time >= cell_bsc.starttime) AND (data1.time <= cell_bsc.endtime) AND (cell_bsc.nome1 =
data1.ne_id))
-> Seq Scan on cell_bsc_60_0610 cell_bsc (cost=0.0..99.39 rows=285 width=20) (actual time=0.033..1.740 rows=285
loops=1)
Filter: (nome2 = 2)
-> Append (cost=0.0..10.6 rows=4 width=16) (actual time=0.012..0.027 rows=13 loops=285)
285*4 should give 1140 max, not 6531: is this different enough?
If it is, I have a 585K dump file that should recreate the problem.