Re: Explain out put

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Explain out put
Дата
Msg-id CAKFQuwZmUCNUcx9i8bX+nkkRCyokPrXPGzdU7fu_3OJ-64C=zg@mail.gmail.com
обсуждение исходный текст
Ответ на Explain out put  (Yambu <hyambu@gmail.com>)
Список pgsql-admin
On Tuesday, July 20, 2021, Yambu <hyambu@gmail.com> wrote:
Hello

I suspect that the partial index is not correct.

It should include both column play_positionand elapsed. may you please help me figure out what's wrong here


Not easily, but I do see the scan of an index with “partial” in its name so it is getting used.  Though the fact it thinks its returning 6,000 or so rows but in actuality gets almost 500,000 (each on two partitions) is a bit worrying (though maybe not solveable…and since you do have nearly 1,000,000 rows to deal with 3 seconds doesn’t seem terrible).  It doesn’t want to do 1,500 nested loops from the media_contents table onto an only 15,000 rows telemetry result.  I don’t know if it would think differently if it knew the inner result is 1 million instead (you could experiment with the planner GUCs).  I don’t know enough about the statistics to give concrete help on improving this other than make sure tou’ve run analyze on the table.

You may find keeping client_id on the telemetry table to be helpful if you need better performance.

All that said, I’m somewhat learning by teaching here so take this with a critical mindset.

I take it the query used to use aggregates?  If not the group by in the main query is just noise.  Also, as you are grouping by account_id in the CTE it will be impossible for rows to exist that the “select distinct” will get rid of.

HTH

David J.


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

Предыдущее
От: Vijaykumar Jain
Дата:
Сообщение: Re: Explain out put
Следующее
От: Vijaykumar Jain
Дата:
Сообщение: Re: Checkpoint taking long