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 968F9D1C98D for ; Wed, 30 Jul 2003 14:08:18 +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 62898-02 for ; Wed, 30 Jul 2003 11:07:20 -0300 (ADT) Received: from relay05.indigo.ie (relay05.indigo.ie [194.125.133.229]) by svr1.postgresql.org (Postfix) with SMTP id 86C49D1C995 for ; Wed, 30 Jul 2003 11:08:16 -0300 (ADT) Received: (qmail 9174 messnum 1247294 invoked from network[193.120.145.156/unknown]); 30 Jul 2003 14:08:13 -0000 Received: from unknown (HELO tcd.ie) (193.120.145.156) by relay05.indigo.ie (qp 9174) with SMTP; 30 Jul 2003 14:08:13 -0000 Message-ID: <3F27D0CD.7000002@tcd.ie> Date: Wed, 30 Jul 2003 15:06:05 +0100 From: Tim McAuley User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mike Mascari Cc: pgsql-general@postgresql.org Subject: Re: Unused Indexes References: <3F27BE36.2090508@tcd.ie> <3F27C462.2040808@mascari.com> In-Reply-To: <3F27C462.2040808@mascari.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1459 X-Sequence-Number: 46312 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 > >This should probably be listed under FAQ 4.8, but it isn't. > > That's it! I had actually just come across that before reading this email. It gets the explain back into shape anyway! Thanks! Tim