X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 58765D1C513 for ; Wed, 30 Jul 2003 13:27:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 58176-08 for ; Wed, 30 Jul 2003 10:26:28 -0300 (ADT) Received: from mail.ez3pl.com (66-136-75-131.ded.swbell.net [66.136.75.131]) by svr1.postgresql.org (Postfix) with ESMTP id 3D888D1C4E7 for ; Wed, 30 Jul 2003 10:27:24 -0300 (ADT) Received: from speedfc.com (djackson.espeedfulfillment.com [172.25.96.11]) by mail.ez3pl.com (8.11.2/8.11.2) with ESMTP id h6UDQco20596; Wed, 30 Jul 2003 08:26:38 -0500 Message-ID: <3F27C790.2030409@speedfc.com> Date: Wed, 30 Jul 2003 08:26:40 -0500 From: DeJuan Jackson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tim McAuley Cc: pgsql-general@postgresql.org Subject: Re: Unused Indexes References: <3F27BE36.2090508@tcd.ie> In-Reply-To: <3F27BE36.2090508@tcd.ie> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1457 X-Sequence-Number: 46310 Assuming you have done a 'VACUUM ANALYZE' on the table in question you are most likely running into a type coercion issue. So explicitly cast your constants to bigint and the index should start being considered. select id from where col2 = 1::bigint and col2 = 1::bigint Tim McAuley wrote: > Hi, > > I have a table which I have populated with over 5000 entries. There is > a combined index placed on two of the columns (both bigint). I am > trying a simple select (i.e. select id where col1 = 1 and col2 = 1) > covering these two columns and it keeps using a seq scan. Is this > correct? I would have thought that with this number of entries that an > index scan should be used. > > I am testing this using postgresql 7.3.3 on windows 2000 using cygwin. > > Doing "set enable_seqscan to off" does not change the results of the > explain operation. > > I also tried setting a single index on just one of the columns and > running an appropriate search; it still uses a seq scan. At what stage > will the planner normally start using an index scan? > > Any hints appreciated. > > Tim > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster