allocation limit for encoding conversion
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2019-08-16T18:14:18Z
Lists: pgsql-hackers
Attachments
- v1-0001-Use-huge-pallocs-on-encoding-conversions.patch (text/x-diff)
Somebody ran into issues when generating large XML output (upwards of
256 MB) and then sending via a connection with a different
client_encoding. This occurs because we pessimistically allocate 4x as
much memory as the string needs, and we run into the 1GB palloc
limitation. ISTM we can do better now by using huge allocations, as per
the preliminary attached patch (which probably needs an updated overflow
check rather than have it removed altogether); but at least it is able
to process this query, which it wasn't without the patch:
select query_to_xml(
'select a, cash_words(a::text::money) from generate_series(0, 2000000) a',
true, false, '');
--
Álvaro Herrera
Commits
-
Avoid unnecessary out-of-memory errors during encoding conversion.
- 6899be28908a 9.4.25 landed
- 677989cc0107 9.6.16 landed
- 54d641da0640 9.5.20 landed
- 226551e7c385 10.11 landed
- e5ff9757194b 11.6 landed
- 8e10405c7450 13.0 landed
- 8381242df587 12.1 landed
-
Allow repalloc() to give back space when a large chunk is downsized.
- 4829576ba44b 9.4.25 landed
- e5e4f12a5f85 9.6.16 landed
- c477f3e449d1 13.0 landed
- 9ad1b572d8b7 10.11 landed
- 9a407209a075 12.1 landed
- 82d0a46ea32d 11.6 landed
- 1534531fe74f 9.5.20 landed