Re: Optimize truncation logic to reduce AccessExclusive lock impact

2025-04-04 Thread Yura Sokolov
19.03.2025 05:09, David Rowley wrote: > On Tue, 18 Mar 2025 at 19:04, Stepan Neretin wrote: >> We propose modifying the truncation condition in should_attempt_truncation >> to avoid unnecessary full buffer scans. The new formula ensures we only >> attempt truncation when we can free at least 3%

Re: Optimize truncation logic to reduce AccessExclusive lock impact

2025-03-21 Thread Yura Sokolov
19.03.2025 19:05, Yura Sokolov wrote: > 19.03.2025 05:09, David Rowley wrote: >> On Tue, 18 Mar 2025 at 19:04, Stepan Neretin wrote: >>> We propose modifying the truncation condition in should_attempt_truncation >>> to avoid unnecessary full buffer scans. >> I'm just following this code through.

Re: Optimize truncation logic to reduce AccessExclusive lock impact

2025-03-18 Thread David Rowley
On Tue, 18 Mar 2025 at 19:04, Stepan Neretin wrote: > We propose modifying the truncation condition in should_attempt_truncation to > avoid unnecessary full buffer scans. The new formula ensures we only attempt > truncation when we can free at least 3% of the relation size + 2 pages. This > cha

Optimize truncation logic to reduce AccessExclusive lock impact

2025-03-17 Thread Stepan Neretin
Hi hackers, We've encountered an issue where autovacuum holds an AccessExclusive lock for an extended period when attempting to truncate heap tables. The root cause appears to be the way autovacuum handles block truncation, specifically when scanning shared buffers during smgrtruncate. This issue