Re: Postgres performs a Seq Scan instead of an Index Scan!

From: James Robinson <jlrobins(at)socialserve(dot)com>
To: Jos van Roosmalen <josr(at)josr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Postgres performs a Seq Scan instead of an Index Scan!
Date: 2004-10-26 16:23:09
Message-ID: 534A925F-276B-11D9-BFDF-000A9566A412@socialserve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Oct 26, 2004, at 12:12 PM, Jos van Roosmalen wrote:

> ATTR1 INT8

Looks like your column is int8, yet your query is sending in an int4.
Therefore the index is not used. This is fixed in PG 8.0. In the mean
time, you can:

SELECT * FROM TESTTABLE WHERE ATTR1=1::INT8 ...

which explicitly casts the literal int4 to an int8, making the int8
column index useable.

----
James Robinson
Socialserve.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jochem van Dieten 2004-10-26 16:24:09 Re: Postgres performs a Seq Scan instead of an Index Scan!
Previous Message Jos van Roosmalen 2004-10-26 16:12:36 Postgres performs a Seq Scan instead of an Index Scan!