lazy_scan_heap() should release lock on buffer before vacuuming FSM - Mailing list pgsql-hackers

From Melanie Plageman
Subject lazy_scan_heap() should release lock on buffer before vacuuming FSM
Date
Msg-id CAAKRu_YiL=44GvGnt1dpYouDSSoV7wzxVoXs8m3p311rp-TVQQ@mail.gmail.com
Whole thread Raw
Responses Re: lazy_scan_heap() should release lock on buffer before vacuuming FSM
List 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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Why do indexes and sorts use the database collation?
Next
From: Melanie Plageman
Date:
Subject: Emit fewer vacuum records by reaping removable tuples during pruning