Re: Use of indexes

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Andre Schubert" <andre(dot)schubert(at)km3(dot)de>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Use of indexes
Date: 2002-04-26 07:30:12
Message-ID: GNELIHDDFBOCMGBFGEFOEEEKCCAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> If i do any explains i got the following:
>
> db_nmkm3=# explain select * from test where id1=1;
> Index Scan using index_test_1 on test (cost=0.00..3.01 rows=1 width=12)
>
> db_nmkm3=# explain select * from test where id2=1;
> Seq Scan on test (cost=0.00..20.55 rows=1 width=12)
>
> db_nmkm3=# explain select * from test where id2=1::int8;
> Index Scan using index_test_2 on test (cost=0.00..3.01 rows=1 width=12)
>
> Can somebody explain me whats wrong with me or my indexes?

Nothing's wrong with your indexes - it's a known limitation of Postgres's
type system.

You just have to use the "::int8" cast and it all works fine.

Chris

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2002-04-26 14:52:31 abnormal size of the on-disk file.
Previous Message Andre Schubert 2002-04-26 07:09:53 Use of indexes