Re: Trying to get postgres to use an index

From: <mike(at)linkify(dot)com>
To: <lists(at)boutiquenumerique(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trying to get postgres to use an index
Date: 2004-11-06 22:01:25
Message-ID: 50156.12.134.204.65.1099778485.squirrel@mail.linkify.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> Well, you're joining the entire two tables, so yes, the seq scan might
> be faster.

My mistake. When composing the email to state the problem, I accidentally
gave a wrong versionof the join query.

Here is the corrected version, which still has the sequential scan...

explain select notificationID from NOTIFICATION n, ITEM i where n.itemID
= i.itemID andi.projectID = 12;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Hash Join (cost=2237.54..15382.32 rows=271 width=44)
Hash Cond: ("outer".itemid = "inner".itemid)
-> Seq Scan on notification n (cost=0.00..12023.71 rows=223671 width=48)
-> Hash (cost=2235.31..2235.31 rows=895 width=4)
-> Index Scan using item_ix_item_4_idx on item i
(cost=0.00..2235.31 rows=895width=4)
Index Cond: (projectid = 12)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Franco Bruno Borghesi 2004-11-06 22:12:16 Re: Mass Import/Generate PKs
Previous Message Ed L. 2004-11-06 21:56:03 Re: Mass Import/Generate PKs