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

From: Kurt Roeckx <Q(at)ping(dot)be>
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:32:51
Message-ID: 20041026163251.GA12528@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-10-26 17:16:31 Re: rmtree() failure on Windows
Previous Message Jochem van Dieten 2004-10-26 16:24:09 Re: Postgres performs a Seq Scan instead of an Index Scan!