Re: Really really slow select count(*)

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: Really really slow select count(*)
Дата
Msg-id 4D504275.5040103@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Really really slow select count(*)  (Craig Ringer <craig@postnewspapers.com.au>)
Ответы Re: Really really slow select count(*)
Список pgsql-performance
Craig Ringer wrote:
> What would possibly help would be if Pg could fall back to lower
> shared_buffers automatically, screaming about it in the logs but still
> launching.

This is exactly what initdb does when it produces an initial setting for
shared_buffers that goes into the postgresql.conf file.  It wouldn't be
hard to move that same logic into a loop that executed when startup
failed to allocated enough memory.

There are two problems here, one almost solved, the other more
philosphical.  It used to be that max_fsm_pages and wal_buffers could be
large enough components to the allocation that reducing them might
actually be a necessary fix, too.  With the removal of the former and a
method to automatically set the latter now available, the remaining
components to the shared memory sizing computation are probably possible
to try and fix automatically if the kernel limits are too low.

But it's unclear whether running in a degraded mode, where performance
might be terrible, with only a log message is preferrable to stopping
and forcing the DBA's attention toward the mistake that was made
immediately.  Log files get rotated out, and it's not hard to imagine
this problem coming to haunt someone only a month or two later--by which
time the change to shared_buffers is long forgotten, and the log message
complaining about it lost too.  Accordingly I would expect any serious
attempt to add some auto-reduction behavior to be beset with argument,
and I'd never consider writing such a thing as a result.  Too many
non-controversial things I could work on instead.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Really really slow select count(*)
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Write-heavy pg_stats_collector on mostly idle server