Re: A question on the query planner

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Greg Stark <gsstark(at)MIT(dot)EDU>
Cc: Jared Carr <jared(at)89glass(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, pgsql-performance(at)postgresql(dot)org
Subject: Re: A question on the query planner
Date: 2003-12-02 22:43:34
Message-ID: 87k75e96y1.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


Greg Stark <gsstark(at)MIT(dot)EDU> writes:

> Huh. The following shows something strange.

Worse, with enable_hashjoin off it's even more obvious something's broken:

test=# set enable_hashjoin = off;
SET
test=# explain select * from a,b where a.x=b.x;
QUERY PLAN
------------------------------------------------------------------
Merge Join (cost=139.66..159.67 rows=1001 width=64)
Merge Cond: ("outer"."?column2?" = "inner"."?column2?")
-> Sort (cost=69.83..72.33 rows=1000 width=32)
Sort Key: (a.x)::text
-> Seq Scan on a (cost=0.00..20.00 rows=1000 width=32)
-> Sort (cost=69.83..72.33 rows=1000 width=32)
Sort Key: (b.x)::text
-> Seq Scan on b (cost=0.00..20.00 rows=1000 width=32)
(8 rows)

test=# explain select * from a2,b2 where a2.x=b2.x;
QUERY PLAN
-----------------------------------------------------------------------------
Merge Join (cost=0.00..63.04 rows=1001 width=64)
Merge Cond: ("outer".x = "inner".x)
-> Index Scan using a2_pkey on a2 (cost=0.00..24.00 rows=1000 width=32)
-> Index Scan using b2_pkey on b2 (cost=0.00..24.00 rows=1000 width=32)
(4 rows)

--
greg

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2003-12-02 23:04:28 Re: cross table indexes or something?
Previous Message Greg Stark 2003-12-02 22:32:11 Re: A question on the query planner