Re: Performance issues

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Performance issues
Дата
Msg-id me9d4u$9b5$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: Performance issues  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Ответы Re: Performance issues
Список pgsql-performance
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.

e.g.:

select distinct on (touchpoint_execution_id) *
from s_f_touchpoint_execution_status_history
order by touchpoint_execution_id, max_creation_dt;




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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: Performance issues
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Performance issues