On Thu, Feb 16, 2023 at 06:00:00PM +0530, Bharath Rupireddy wrote: > The memory usage goes up with many WAL records in GetWALRecordsInfo(). > The affected functions are pg_get_wal_records_info() and > pg_get_wal_records_info_till_end_of_wal(). I think the best way to fix > this is to use a temporary memory context (like the jsonfuncs.c), > reset it after every tuple is put into the tuple store. This fix keeps > the memory under limits. I'm attaching the patches here.
What you are doing here looks OK, at quick glance. That's common across the code, see also dblink or file_fdw. > For HEAD, I'd > want to be a bit defensive and use the temporary memory context for > pg_get_wal_fpi_info() too. If there is a burst of FPWs across the range you are scanning, the problem could be equally worse. Sorry for missing that. -- Michael
signature.asc
Description: PGP signature