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

2004-10-26 Thread Kurt Roeckx
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: expl

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

2004-10-26 Thread Jochem van Dieten
On Tue, 26 Oct 2004 18:12:36 +0200, Jos van Roosmalen wrote: > > I have a little question. Why performs Postgresql a Seq. Scan in the > next Select statement instead of a Index Read? That is a FAQ: http://www.postgresql.org/docs/faqs/FAQ.html#4.8 Please direct any further questions of this natu

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

2004-10-26 Thread James Robinson
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 ca