Re: Unused Indexes - Mailing list pgsql-general

From Mike Mascari
Subject Re: Unused Indexes
Date
Msg-id 3F27C462.2040808@mascari.com
Whole thread Raw
In response to Unused Indexes  (Tim McAuley <mcauleyt@tcd.ie>)
Responses Re: Unused Indexes  (Mike Mascari <mascarm@mascari.com>)
Re: Unused Indexes  (Tim McAuley <mcauleyt@tcd.ie>)
List 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@mascari.com




pgsql-general by date:

Previous
From: Tim McAuley
Date:
Subject: Unused Indexes
Next
From: Mike Mascari
Date:
Subject: Re: Unused Indexes