Re: Performance issues

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: Performance issues
Дата
Msg-id 55083D74.4000601@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Performance issues  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: Performance issues  (Vivekanand Joshi <vjoshi@zetainteractive.com>)
Re: Performance issues  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-performance
On 17.3.2015 15:19, Thomas Kellerer wrote:
> Tomas Vondra schrieb am 17.03.2015 um 14:55:
>>  (2) using window functions, e.g. like this:
>>
>>      SELECT * FROM (
>>        SELECT *,
>>             ROW_NUMBER() OVER (PARTITION BY touchpoint_execution_id
>>                                ORDER BY FROM max_creation_dt) AS rn
>>        FROM s_f_touchpoint_execution_status_history
>>      ) foo WHERE rn = 1
>>
>>      But estimating this is also rather difficult ...
>
>
> From my experience rewriting something like the above using DISTINCT
> ON is usually faster.

How do you get the last record (with respect to a timestamp column)
using a DISTINCT ON?


--
Tomas Vondra                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Performance issues
Следующее
От: Vivekanand Joshi
Дата:
Сообщение: Re: Performance issues