Re: CPU Consuming query. Sequential scan despite indexing.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: CPU Consuming query. Sequential scan despite indexing.
Дата
Msg-id CAKFQuwZELmRLaocK34K7ByCauBv2JmW6zmPG3V9QPpWE4PKbrg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: CPU Consuming query. Sequential scan despite indexing.  (aditya desai <admad123@gmail.com>)
Ответы Re: CPU Consuming query. Sequential scan despite indexing.
Список pgsql-performance
On Wed, Oct 21, 2020 at 10:22 PM aditya desai <admad123@gmail.com> wrote:
As per application team, it is business requirement to show last 60 days worth data.

I didn't look deeply but it sounds like you are looking backwards into 60 days worth of detail every single time you perform the query and computing an aggregate directly from the detail.  Stop doing that.  By way of example, at the end of every day compute the aggregates on the relevant dimensions and save them.  Then query the saved aggregates from previous days and add them to the computed aggregate from the current day's detail.

David J.

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

Предыдущее
От: aditya desai
Дата:
Сообщение: Re: CPU Consuming query. Sequential scan despite indexing.
Следующее
От: aditya desai
Дата:
Сообщение: Re: CPU Consuming query. Sequential scan despite indexing.