BUG #15321: XMLTABLE leaks memory like crazy

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #15321: XMLTABLE leaks memory like crazy
Дата
Msg-id 153394403528.10284.7530399040974170549@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #15321: XMLTABLE leaks memory like crazy  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15321
Logged by:          Andrew Gierth
Email address:      andrew@tao11.riddles.org.uk
PostgreSQL version: 10.5
Operating system:   any
Description:

From a report on IRC:

XMLTABLE runs a lot of setup code in the per-query memory context -
resulting in allocations of copies of namespace names, other values, and
_multiple copies of the passed-in XML document_, which are not freed
anywhere.

Accordingly, virtually any lateral call to XMLTABLE on non-toy amounts of
data will blow up the server memory usage:

select count(*)
  from (select ('<rec xmlns="http://foobar">'
                ||
repeat('<obj><col1>foo</col1><col2>bar</col2></obj>',10+(i%10))
                || '</rec>')::xml as content
          from generate_series(1,1000000) i) s,
       xmltable(xmlnamespaces('http://foobar' AS x),
                'x:obj'
                passing t.content
                columns col1 text path 'x:col1'
                columns col2 text path 'x:col2'
                );
-- uses about 6GB of RAM in my tests


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

Предыдущее
От: Martin Marques
Дата:
Сообщение: Re: [PG_UPGRADE] 9.6 to 10.5
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: BUG #15321: XMLTABLE leaks memory like crazy