lazy_scan_heap() should release lock on buffer before vacuuming FSM

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: lazy_scan_heap() should release lock on buffer before vacuuming FSM
Date: 2023-11-13 22:13:32
Message-ID: CAAKRu_YiL=44GvGnt1dpYouDSSoV7wzxVoXs8m3p311rp-TVQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that in lazy_scan_heap(), when there are no indexes on the
table being vacuumed, we don't release the lock on the heap page buffer
before vacuuming the freespace map. Other call sites of
FreeSpaceMapVacuumRange() hold no such lock. It seems like a waste to
hold a lock we don't need.

ISTM the fix (attached) is just to move down the call to
FreeSpaceMapVacuumRange() to after we've released the lock and recorded
the space we just freed.

- Melanie

Attachment Content-Type Size
v1-0001-Release-lock-on-heap-buffer-before-vacuuming-FSM.patch text/x-patch 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2023-11-13 22:28:50 Emit fewer vacuum records by reaping removable tuples during pruning
Previous Message Andres Freund 2023-11-13 22:12:12 Re: Why do indexes and sorts use the database collation?