Re: Extremely slow count (simple query, with index)

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: Extremely slow count (simple query, with index)
Дата
Msg-id CAHOFxGpxMsgxQZ-H1C5v_A5FK-XqdTQ_m4agJWD0FfNPOrfMww@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Extremely slow count (simple query, with index)  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: Extremely slow count (simple query, with index)  (Marco Colli <collimarco91@gmail.com>)
Список pgsql-performance
You can SELECT reltuples FROM pg_class WHERE oid='subscriptions'::oid, but its
accuracy depends on frequency of vacuum (and if a large delete/insert happened
since the most recent vacuum/analyze).

This only seems helpful to find approx. count for the entire table, without considering the WHERE condition.

Marco,
As Justin pointed out, you have most of your time in the bitmap heap scan. Are you running SSDs? I wonder about tuning effective_io_concurrency to make more use of them.

"Currently, this setting only affects bitmap heap scans."

Also, how many million rows is this table in total? Have you considered partitioning?

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

Предыдущее
От: MichaelDBA
Дата:
Сообщение: Re: Extremely slow count (simple query, with index)
Следующее
От: legrand legrand
Дата:
Сообщение: Re: Erratically behaving query needs optimization