Re: Postgres performs a Seq Scan instead of an Index Scan! - Mailing list pgsql-hackers

From Kurt Roeckx
Subject Re: Postgres performs a Seq Scan instead of an Index Scan!
Date
Msg-id 20041026163251.GA12528@ping.be
Whole thread Raw
In response to Postgres performs a Seq Scan instead of an Index Scan!  (Jos van Roosmalen <josr@josr.org>)
List pgsql-hackers
On Tue, Oct 26, 2004 at 06:12:36PM +0200, Jos van Roosmalen wrote:
> 
> CREATE TABLE TESTTABLE (ATTR1 INT8,ATTR2 INT4,ATTR3 TIMESTAMP);
> CREATE UNIQUE INDEX TESTINDEX ON TESTTABLE(ATTR1,ATTR2,ATTR3);
> EXPLAIN SELECT * FROM TESTTABLE WHERE ATTR1=1 AND ATTR2=2 AND 
> ATTR3='2004-01-01';


try:
explain select * from testtable where attr1=1::int8 and attr2=2
and attr3='2004-01-01';

Or change the int8 to bigint.

Isn't this in some FAQ yet?

It will not do an index scan if the types don't match.


Kurt



pgsql-hackers by date:

Previous
From: Jochem van Dieten
Date:
Subject: Re: Postgres performs a Seq Scan instead of an Index Scan!
Next
From: Tom Lane
Date:
Subject: Re: rmtree() failure on Windows