On Wed, Mar 7, 2012 at 5:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> What I suggest is that it should not be necessary to crawl forward one
> page at a time to figure out how many pages will be needed to store N
> bytes worth of WAL data. You're basically implementing a division
> problem as repeated subtraction. Getting the extra WAL-segment-start
> overhead right would be slightly tricky; but even if you didn't want to
> try to make it pure straight-line code, at the very least it seems like
> you could set it up so that the loop iterates only once per segment not
> page.
+1
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center