Re: A question on the query planner

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Jared Carr <jared(at)89glass(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: A question on the query planner
Date: 2003-12-03 01:33:15
Message-ID: 87znea7kis.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Define "no longer works well". varchar doesn't have its own comparison
> operators anymore, but AFAIK that makes no difference.

Well it seems to completely bar the use of a straight merge join between two
index scans:

test=# set enable_seqscan = off;
SET

test=# explain select * from a,b where a.x=b.x;
QUERY PLAN
---------------------------------------------------------------------------
Nested Loop (cost=100000000.00..100002188.86 rows=1001 width=64)
-> Seq Scan on a (cost=100000000.00..100000020.00 rows=1000 width=32)
-> Index Scan using b_pkey on b (cost=0.00..2.16 rows=1 width=32)
Index Cond: (("outer".x)::text = (b.x)::text)
(4 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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-12-03 01:50:40 Re: cross table indexes or something?
Previous Message Tom Lane 2003-12-02 23:50:47 Re: A question on the query planner