Re: Unused Indexes

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Tim McAuley <mcauleyt(at)tcd(dot)ie>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unused Indexes
Date: 2003-07-30 13:13:06
Message-ID: 3F27C462.2040808@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)mascari(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2003-07-30 13:16:00 Re: Unused Indexes
Previous Message Tim McAuley 2003-07-30 12:46:46 Unused Indexes