Re: [SQL] Why is it not using an index?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: [SQL] Why is it not using an index?
Дата
Msg-id 20020315101751.N51975-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Why is it not using an index?  (Dmitry Tkach <dmitry@openratings.com>)
Ответы Yet another indexing issue.  ("David Siebert" <david@eclipsecat.com>)
Список pgsql-general
On Fri, 15 Mar 2002, Dmitry Tkach wrote:

> This must be really simple, but I just can't get it :-(
> I have a table (a) with a single column (x):
>
>            Table "a"
>   Attribute |   Type   | Modifier
> -----------+----------+----------
>   x         | smallint |
> Index: a_idx
>
>
>     Index "a_idx"
>   Attribute |   Type
> -----------+----------
>   x         | smallint
> btree
>
> The table has 10000000 rows....
>
> Now, how come, when I do:
>
> explain select * from a where x=3;

You'll need to cast the 3 into smallint explicitly, either
3::smallint or CAST(3 as smallint) should work.



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

Предыдущее
От: John Gray
Дата:
Сообщение: Re: Archives / News gateway
Следующее
От: "Gregory Wood"
Дата:
Сообщение: Re: Why is it not using an index?