pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim McAuley <mcauleyt@tcd.ie>
To: Mike Mascari <mascarm@mascari.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Unused Indexes
Date: Wed, 30 Jul 2003 15:06:05 +0100
Message-ID: <3F27D0CD.7000002@tcd.ie> (raw)
In-Reply-To: <3F27C462.2040808@mascari.com>
References: <3F27BE36.2090508@tcd.ie>
	<3F27C462.2040808@mascari.com>

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





view thread (13+ messages)  latest in thread

Message-ID: <3F27D0CD.7000002@tcd.ie>
Permalink:  ../3F27D0CD.7000002@tcd.ie/
Also on:    postgresql.org/message-id/3F27D0CD.7000002@tcd.ie

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: mcauleyt@tcd.ie, mascarm@mascari.com
  Subject: Re: Unused Indexes
  In-Reply-To: <3F27D0CD.7000002@tcd.ie>
  References: <3F27BE36.2090508@tcd.ie> <3F27C462.2040808@mascari.com> <3F27D0CD.7000002@tcd.ie>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox