Re: Use of indexes

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Use of indexes
Дата
Msg-id GNELIHDDFBOCMGBFGEFOEEEKCCAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Use of indexes  (Andre Schubert <andre.schubert@km3.de>)
Список 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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Andre Schubert
Дата:
Сообщение: Use of indexes
Следующее
От: "Brubaker, Shane"
Дата:
Сообщение: Collection of PostgreSQL Performance Tips