autovacuum and TOAST tables - Mailing list pgsql-hackers

From Alvaro Herrera
Subject autovacuum and TOAST tables
Date
Msg-id 20080808165809.GB3800@alvh.no-ip.org
Whole thread Raw
Responses Re: autovacuum and TOAST tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

Here's a patch to make autovacuum process TOAST tables separately from
main tables.

The most important change is that when called from autovac, vacuum does
not process the TOAST table at all.  It will only do so when the stats
for the TOAST table say that it needs vacuuming.  (A user-invoked vacuum
still processes TOAST tables normally.)

Per previous discussion, the autovac code is now doing two passes over
pg_class.

There's two things I'm not happy about in this patch:

1. it uses a List to keep the mapping of heap<->toast Oids.  This is
needed to be able to fetch the main rel's pg_autovacuum entry to process
the toast table.  This incurs in O(n^2) behavior.

2. the "expected relkind" business is gone; it's not easy to pass the
correct relkind down from autovac, and at the same time have a
reasonable thing to pass down from user-invoked vacuum.  Right now what
the patch does is check that the rel to vacuum is either
RELKIND_RELATION or _TOASTVALUE.

(I admit that my unhappiness about the second is mild, though.)

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment

pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: CommitFest July Over
Next
From: Josh Berkus
Date:
Subject: Re: Proposal of SE-PostgreSQL patches [try#2]