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 B8493D1C4B7 for ; Wed, 30 Jul 2003 13:16:29 +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 60185-01 for ; Wed, 30 Jul 2003 10:15:32 -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 14A41D1C4D7 for ; Wed, 30 Jul 2003 10:16:28 -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 h6UDG0322197; Wed, 30 Jul 2003 09:16:00 -0400 Message-ID: <3F27C510.1090708@mascari.com> Date: Wed, 30 Jul 2003 09:16:00 -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: Mike Mascari Cc: Tim McAuley , pgsql-general@postgresql.org Subject: Re: Unused Indexes References: <3F27BE36.2090508@tcd.ie> <3F27C462.2040808@mascari.com> In-Reply-To: <3F27C462.2040808@mascari.com> 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/1454 X-Sequence-Number: 46307 Mike Mascari wrote: > 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 That should read: SELECT id WHERE col1 = 1::bigint AND col2 = 1::bigint. My dyslexia is kicking in... Mike Mascari mascarm@mascari.com