Re: Debugging a backend stuck consuming CPU

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Debugging a backend stuck consuming CPU
Дата
Msg-id 49743.1463694746@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Debugging a backend stuck consuming CPU  ("ktm@rice.edu" <ktm@rice.edu>)
Ответы Re: Debugging a backend stuck consuming CPU  ("ktm@rice.edu" <ktm@rice.edu>)
Список pgsql-general
"ktm@rice.edu" <ktm@rice.edu> writes:
> The stack trace just appeared to be what I would expect while a 'DISCARD ALL'
> command was being run:

> #0  0x000000000073bc7c in MemoryContextSetParent ()
> #1  0x000000000073bde3 in MemoryContextDelete ()
> #2  0x000000000054e3a9 in DropAllPreparedStatements ()
> #3  0x00000000005365f3 in DiscardCommand ()

Hmm, what it seems from these traces is that you've got a whole heck of
a lot of prepared statements.

> The backend does have a very large memory footprint (12GB).

Um.

The most likely explanation is that you are hitting O(N^2) behavior as
a consequence of MemoryContextSetParent being O(N) in the number of
sibling contexts of the context to be deleted.  We fixed that for 9.6
(commit 25c539233044c235e97fd7c9dc600fb5f08fe065) but there's no easy
solution in older branches, short of not using so many prepared
statements.  I'm a bit surprised that you could have gotten up to 12GB
worth of prepared statements in an application that sends DISCARD ALL
periodically.

            regards, tom lane


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

Предыдущее
От: Cameron Smith
Дата:
Сообщение: Re: PostgreSQL with BDR - PANIC: could not create replication identifier checkpoint
Следующее
От: Martín Marqués
Дата:
Сообщение: Re: PostgreSQL with BDR - PANIC: could not create replication identifier checkpoint