Re: Slow plan for MAX/MIN or LIMIT 1?

Поиск
Список
Период
Сортировка
От Claudio Freire
Тема Re: Slow plan for MAX/MIN or LIMIT 1?
Дата
Msg-id CAGTBQpa=5xrwb00gHmsxEzt6bTktPe5sguK+9yuQccGPUfBnCQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Slow plan for MAX/MIN or LIMIT 1?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-performance
On Wed, Sep 25, 2013 at 12:54 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
>> I was thinking an index over:
>>
>> (event, date_trunc('day', insert_time), log_id)
>>
>> And the query like
>>
>> SELECT min(log_id) FROM event_log
>> WHERE event='S-Create' AND
>> date_trunc('day',insert_time) = '2013-09-15'
>>
>>
>> That's a regular simple range scan over the index.
>
> *) date_trunc has same problems as ::date: it is stable expression
> only for timestamptz.  also, the index will be bigger since you're
> still indexing timestamp


Ah, yes, good point.


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

Предыдущее
От: "Sam Wong"
Дата:
Сообщение: Re: Slow plan for MAX/MIN or LIMIT 1?
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Why is n_distinct always -1 for range types?