Re: Occasional performance issue after changing table partitions

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: Occasional performance issue after changing table partitions
Дата
Msg-id 20220710140519.GN13040@telsasoft.com
обсуждение исходный текст
Ответ на Occasional performance issue after changing table partitions  (Nathan Ward <lists+postgresql@daork.net>)
Ответы Re: Occasional performance issue after changing table partitions  (Nathan Ward <lists+postgresql@daork.net>)
Список pgsql-performance
On Sun, Jul 10, 2022 at 04:55:34PM +1200, Nathan Ward wrote:
> I am running Postgres 13 on CentOS 7, installed from the yum.postgresql.org <http://yum.postgresql.org/> repo.

It doesn't sound relevant, but what kind of storage systems is postgres using ?
Filesystem, raid, device.

Is the high CPU use related to to autovacuum/autoanalyze ?

> The issue I am having, is that when the daily data usage aggregation runs, sometimes we have a big performance
impact,with the following characteristics which happen *after* the aggregation job runs in it usual fast time of 12s or
so:
> - The aggregation runs fast as per normal
> - Load on the server goes to 30-40 - recall we have quite high “max connections” to keep throughput high when the
clientis far (16ms) from the server
 

I suggest to install and enable autoexplain to see what's running slowly here,
and what its query plans are.  It seems possible that when the daily
aggregation script drops the old partitions, the plan changes for the worse.
I'm not sure what the fix is - maybe you just need to run vacuum or analyze on
the new partitions soon after populating them.

For good measure, also set log_autovacuum_min_duration=0 (or something other
than -1) (and while you're at it, log_checkpoints=on, and log_lock_waits=on if
you haven't already).

Note that postgres doesn't automatically analyze parent tables, so you should
maybe do that whenever the data changes enough for it to matter.

-- 
Justin



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

Предыдущее
От: Nathan Ward
Дата:
Сообщение: Occasional performance issue after changing table partitions
Следующее
От: Nathan Ward
Дата:
Сообщение: Re: Occasional performance issue after changing table partitions