From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | andrew(at)tao11(dot)riddles(dot)org(dot)uk |
Subject: | BUG #15321: XMLTABLE leaks memory like crazy |
Date: | 2018-08-10 23:33:55 |
Message-ID: | 153394403528.10284.7530399040974170549@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15321
Logged by: Andrew Gierth
Email address: andrew(at)tao11(dot)riddles(dot)org(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-08-11 00:28:47 | Re: BUG #15321: XMLTABLE leaks memory like crazy |
Previous Message | Martin Marques | 2018-08-10 20:41:14 | Re: [PG_UPGRADE] 9.6 to 10.5 |