X-Original-To: pgsql-performance@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 43AA2924FEA for ; Tue, 20 May 2003 11:18:36 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 84718-01 for ; Tue, 20 May 2003 11:18:33 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id 67C1B924FF8 for ; Tue, 20 May 2003 11:18:32 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4KFIRU6029059; Tue, 20 May 2003 11:18:28 -0400 (EDT) To: "amol" Cc: pgsql-performance@postgresql.org Subject: Re: nested select query failing In-reply-to: <00a101c31ea1$19e03d80$2e00a8c0@amol> References: <20030515075032.B60859-100000@megazone23.bigpanda.com> <00a101c31ea1$19e03d80$2e00a8c0@amol> Comments: In-reply-to "amol" message dated "Tue, 20 May 2003 12:56:16 +0530" Date: Tue, 20 May 2003 11:18:26 -0400 Message-ID: <29058.1053443906@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/195 X-Sequence-Number: 1974 "amol" writes: > explain analyze select attached_info.id from attached_tag_list, > attached_info > where > attached_tag_list.attached_tag = 265 > and > attached_tag_list.id = attached_info.id > NOTICE: QUERY PLAN: > Nested Loop (cost=0.00..165349.50 rows=114 width=16) (actual > time=117.14..8994.60 rows=15 loops=1) > -> Index Scan using ix_attached_tag_list_id on attached_tag_list > (cost=0.00..111.13 rows=96 width=12) (actual time=0.12..0.66 rows=15 > loops=1) > -> Seq Scan on attached_info (cost=0.00..1211.53 rows=33553 width=4) > (actual time=3.67..197.98 rows=33553 loops=15) > Total runtime: 8994.92 msec > - I have already indexed attached_info on id using following query > CREATE INDEX attached_info_Index_1 ON attached_info(id) ; Hm. I'd have expected an index scan too. Maybe the two id columns are not of the same datatype? regards, tom lane