Vacuum related question

From: Bartosz Stalewski <bartekstalewski(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Vacuum related question
Date: 2025-03-07 11:16:38
Message-ID: CAE0uZgfFxgpNjC1t6zOict9hXi9=6S3zAmfpV+Xe-ZTBWJbCew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello All!

I'm currently using 17.2 version and working on optimizing vacuums.
I would be greateful if you could confirm (or deny) my idea.

Current situation:
Every 4-5 days vacuum to prevent wraparound is running in my DB, which of
course is bad. There are a few tables that are constantly being updated
(both inserts and updates) - they are quite big - ranging from a few
hundred million to over a billion rows.
Other tables get only inserts (with similar size - they may reach over a
billion rows).

Solution:
I would like to have a quick vacuum to freeze old tuples - it would be
quick because it would omit indexes (because switch INDEX_CLEANUP would be
set as false). Additionally for tables with dead tuples I would run vacuum
with INDEX_CLEANUP set as true during weekend. Omitting indexes makes a
huge difference in terms of vacuum time.

Would it be a problem from performance point of view (e.g. accumulating
some bloat?) if tables that do not contain dead tuples are vacuumed only
with flag INDEX_CLEANUP set as false? I have a feeling that it is fine, but
unfortunately I couldn't find any clear evidence when browsing Internet.

Thanks in advance,
Bartek

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2025-03-07 13:24:57 Re: [EXTERNAL] Re: Asking for OK for a nasty trick to resolve PG CVE-2025-1094 i
Previous Message Adrian Klaver 2025-03-06 20:34:59 Re: Duplicate Key Values