Re: Vacuum: allow usage of more than 1GB of work mem - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Vacuum: allow usage of more than 1GB of work mem
Date
Msg-id CANP8+jJQ2ZXVDwWQ6+74_t-7cZkh1EVNKi9pBx5qKs=NaYChUQ@mail.gmail.com
Whole thread Raw
In response to Re: Vacuum: allow usage of more than 1GB of work mem  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Vacuum: allow usage of more than 1GB of work mem
List pgsql-hackers
On 6 September 2016 at 19:59, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> The idea of looking to the stats to *guess* about how many tuples are
> removable doesn't seem bad at all.  But imagining that that's going to be
> exact is folly of the first magnitude.

Yes.  Bear in mind I had already referred to allowing +10% to be safe,
so I think we agree that a reasonably accurate, yet imprecise
calculation is possible in most cases.

If a recent transaction has committed, we will see both committed dead
rows and stats to show they exist. I'm sure there are corner cases and
race conditions where a major effect (greater than 10%) could occur,
in which case we run the index scan more than once, just as we do now.

The attached patch raises the limits as suggested by Claudio, allowing
for larger memory allocations if possible, yet limits the allocation
for larger tables based on the estimate gained from pg_stats, while
adding 10% for caution.

--
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Kuntal Ghosh
Date:
Subject: Re: WAL consistency check facility
Next
From: Fujii Masao
Date:
Subject: Re: [COMMITTERS] pgsql: Fix VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL