pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Mungall <cjm@fruitfly.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: abnormally long time in performing a two-table join
Date: Sun, 11 Aug 2002 17:41:35 -0400
Message-ID: <23739.1029102095@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.33.0208111408010.16003-100000@sos.lbl.gov>
References: <Pine.LNX.4.33.0208111408010.16003-100000@sos.lbl.gov>

Chris Mungall <cjm@fruitfly.org> writes:
> Nested Loop  (cost=0.00..197011.39 rows=223 width=8) (actual time=16744.92..44572.00 rows=15 loops=1)
>   ->  Index Scan using seqfeature_pkey on seqfeature  (cost=0.00..61715.62 rows=44674 width=4) (actual time=0.29..14669.06 rows=100030 loops=1)
>   ->  Index Scan using sfqv_idx1 on sfqv  (cost=0.00..3.02 rows=1 width=4) (actual time=0.29..0.29 rows=0 loops=100030)

Odd ... I'm surprised it doesn't choose a hash join.  What do you get if
you try it with "set enable_nestloop = off" ?

> CREATE INDEX sfqv_idx4 ON sfqv USING btree (seqfeature_id, qualifier_value);

> I would have thought sfqv_idx4 would be useful in this particular query?

You'd have to write

select ... where qualifier_value = 'BRCA1' and
seqfeature.seqfeature_key_id = 15 and
sfqv.seqfeature_key_id = 15

to get it to consider that index.  You know and I know that the join
should imply sfqv.seqfeature_key_id = 15, but the planner doesn't.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <23739.1029102095@sss.pgh.pa.us>
Permalink:  ../23739.1029102095@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23739.1029102095@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cjm@fruitfly.org
  Subject: Re: abnormally long time in performing a two-table join
  In-Reply-To: <23739.1029102095@sss.pgh.pa.us>
  References: <Pine.LNX.4.33.0208111408010.16003-100000@sos.lbl.gov> <23739.1029102095@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox