Received: from lin.local.lan ([216.221.221.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0VGvUq52836 for ; Wed, 31 Jan 2001 11:57:30 -0500 (EST) (envelope-from najm@mondo-live.com) Received: from mondo-live.com (IDENT:najm@ll20.local2.lan [192.168.2.20]) by lin.local.lan (8.9.3/8.8.7) with ESMTP id PAA03913 for ; Wed, 31 Jan 2001 15:51:41 GMT Message-ID: <3A7996AC.AD99A45B@mondo-live.com> Date: Thu, 01 Feb 2001 12:02:36 -0500 From: Najm Hashmi X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-sql@postgresql.org" Subject: Index scan Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/483 X-Sequence-Number: 1159 Hi all, I am unable to understand why my inidcies are not used in the query. I have following indices: index on categories.root index on media.category unique index on categories.id Here is my query : mondo=# explain select m.id form media m, categories c where c.id=m.category and c.root like 'B%'; NOTICE: QUERY PLAN: Hash Join (cost=22.55..116.80 rows=11 width=28) -> Seq Scan on media m (cost=0.00..60.40 rows=840 width=16) -> Hash (cost=22.50..22.50 rows=20 width=12) -> Index Scan using cat_id_root on categories c (cost=0.00..22.50 rows=20 width=12) EXPLAIN I simply dont understand why it uses seq scan on media. Thanks all for your help. -Najm