Re: select is not using index?

Поиск
Список
Период
Сортировка
От Corey Edwards
Тема Re: select is not using index?
Дата
Msg-id 1075936942.12400.18.camel@harvey
обсуждение исходный текст
Ответ на select is not using index?  (Mark Harrison <mh@pixar.com>)
Список pgsql-performance
On Wed, 2004-02-04 at 14:55, Mark Harrison wrote:
> testdb=# \d bigtable
>       Table "public.bigtable"
>   Column  |  Type   | Modifiers
> ---------+---------+-----------
>   id      | bigint  | not null
>   typeid  | integer | not null
>   reposid | integer | not null
> Indexes: bigtable_id_key unique btree (id)

> testdb=# explain select * from bigtable where id = 123;

Your column is a bigint but 123 defaults to type int. Indexes aren't
used when there's a type mismatch. Use an explicit cast or quote it:

  select * from bigtable where id = 123::bigint;

Or

  select * from bigtable where id = '123';

Corey



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

Предыдущее
От: Mark Harrison
Дата:
Сообщение: select is not using index?
Следующее
От: Orion Henry
Дата:
Сообщение: 7.3 vs 7.4 performance