Re: Why does a simple query not use an obvious index?

Поиск
Список
Период
Сортировка
От Steinar H. Gunderson
Тема Re: Why does a simple query not use an obvious index?
Дата
Msg-id 20040829185750.GA30018@uio.no
обсуждение исходный текст
Ответ на Re: Why does a simple query not use an obvious index?  (Mr Pink <mr_pink_is_the_only_pro@yahoo.com>)
Список pgsql-performance
On Sun, Aug 29, 2004 at 11:04:48AM -0700, Mr Pink wrote:
> Another is that if the condition data types don't match then an indes won't be used you could try:
>
>   select count(*) from billing where timestamp > (now()-60)::timestamp

In fact, I've had success with code like

    select count(*) from billing where timestamp > ( select now() - interval '1 minute' )

At least in my case (PostgreSQL 7.2, though), it made PostgreSQL magically do
an index scan. :-)

/* Steinar */
--
Homepage: http://www.sesse.net/

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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Why does a simple query not use an obvious index?
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Equivalent praxis to CLUSTERED INDEX?