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 103A1D1C977 for ; Wed, 30 Jul 2003 13:13:27 +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 60089-02 for ; Wed, 30 Jul 2003 10:12:28 -0300 (ADT) Received: from corvette.mascari.com (dhcp065-024-158-068.columbus.rr.com [65.24.158.68]) by svr1.postgresql.org (Postfix) with ESMTP id 5E190D1C4D7 for ; Wed, 30 Jul 2003 10:13:24 -0300 (ADT) Received: from mascari.com (ferrari.mascari.com [192.168.2.1]) by corvette.mascari.com (8.11.6/8.11.6) with ESMTP id h6UDD6322187; Wed, 30 Jul 2003 09:13:06 -0400 Message-ID: <3F27C462.2040808@mascari.com> Date: Wed, 30 Jul 2003 09:13:06 -0400 From: Mike Mascari User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.4) Gecko/20030624 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> X-Enigmail-Version: 0.74.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1453 X-Sequence-Number: 46306 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. You must cast the 1 to a bigint: SELECT id WHERE col1 = 1::bigint AND col1 = 2::bigint This should probably be listed under FAQ 4.8, but it isn't. Hope that helps, Mike Mascari mascarm@mascari.com