Re: maintenance_work_mem = 64kB doesn't work for vacuum

Masahiko Sawada <sawada.mshk@gmail.com>

From: Masahiko Sawada <sawada.mshk@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-03-17T16:48:29Z
Lists: pgsql-hackers

Attachments

On Mon, Mar 10, 2025 at 2:53 AM David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Mon, 10 Mar 2025 at 17:22, Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> > Regarding that patch, we need to note that the lpdead_items is a
> > counter that is not reset in the entire vacuum. Therefore, with
> > maintenance_work_mem = 64kB, once we collect at least one lpdead item,
> > we perform a cycle of index vacuuming and heap vacuuming for every
> > subsequent block even if they don't have a lpdead item. I think we
> > should use vacrel->dead_items_info->num_items instead.
>
> OK, I didn't study the code enough to realise that. My patch was only
> intended as an indication of what I thought. Please feel free to
> proceed with your own patch using the correct field.
>

I've attached the patch. I added the minimum regression tests for that.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Commits

  1. Fix assertion failure in parallel vacuum with minimal maintenance_work_mem setting.

  2. Lower minimum maintenance_work_mem to 64kB