VACUUM for TOASTed objects

Started by Soroosh Sardariabout 12 years ago2 messages
#1Soroosh Sardari
soroosh.sardari@gmail.com

Hi

The vacuum procedure do rewrite for a table but, what happened if the table
has some TOASTed columns?

Please, help me to find a module or function in source code which is
responsible for
vaccuming the TOAST relation.

Regards,
Soroosh Sardari

#2Michael Paquier
michael.paquier@gmail.com
In reply to: Soroosh Sardari (#1)
Re: VACUUM for TOASTed objects

On Wed, Nov 20, 2013 at 5:46 PM, Soroosh Sardari
<soroosh.sardari@gmail.com> wrote:

Hi

The vacuum procedure do rewrite for a table but, what happened if the table
has some TOASTed columns?

Please, help me to find a module or function in source code which is
responsible for
vaccuming the TOAST relation.

A toast table is vacuumed with its master table when vacuum is done on
this master table. Have a look at vacuum.c:1150~:
/*
* If the relation has a secondary toast rel, vacuum that too while we
* still hold the session lock on the master table. Note however that
* "analyze" will not get done on the toast table. This
is good, because
* the toaster always uses hardcoded index access and statistics are
* totally unimportant for toast relations.
*/
if (toast_relid != InvalidOid)
vacuum_rel(toast_relid, vacstmt, false, for_wraparound);
Regards,
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers