Heni Lolov <hal_bg@yahoo.com> writes:
> explain select *
> from tyc_glup
> where de>0 and de<1000000 and ra<100000 and ra>0;
> NOTICE: QUERY PLAN:
> Merge Join (cost=42975.66..44050.21 rows=34159 width=50)
> -> Sort (cost=108.53..108.53 rows=26 width=14)
> -> Index Scan using tycho_drm on tycho (cost=0.00..107.90 rows=26
> width=14)
> -> Sort (cost=42867.14..42867.14 rows=258997 width=36)
> -> Seq Scan on sao (cost=0.00..4609.97 rows=258997 width=36)
Hmm. This plan doesn't make a lot of sense to me; with so few rows
coming out of tycho, I'd have expected the thing to pick a nestloop.
Do you have enable_nestloop turned off? What plan do you get for this
query if you set enable_mergejoin to off?
Also, what PG version is this?
regards, tom lane