Re: DROP TABLE and autovacuum

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: DROP TABLE and autovacuum
Date: 2007-06-13 13:48:12
Message-ID: 20070613134812.GI4640@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

ITAGAKI Takahiro wrote:
> If we tries to drop the table on which autovacuum is running, we have to
> wait finish of the vacuum. However, the vacuuming effort goes to waste for
> the table being dropped or rewritten. Meanwhile, we've already had the
> autovacuum killer triggered in CREATE/DROP/RENAME DATABASE commands.
> Can we extend the feature to several TABLE commands?
>
> One simple solution is that every time a non-autovacuum backend tries to
> access a table with a lock equal or stronger than SHARE UPDATE EXCLUSIVE,
> the backend checks whether some autovacuum workers are vacuuming the table
> and send SIGINT to them.
>
> Is this worth doing? Or are there any dangerous situation in it?

Well, one problem with this is that currently SIGINT cancels the whole
autovacuum worker, not just the table currently being processed. I
think this can be fixed easily by improving the signal handling.

Aside from that, I don't see any problem in handling DROP TABLE like you
suggest. But I don't feel comfortable with doing it with just any
strong locker, because that would easily starve tables from being
vacuumed at all.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-13 13:51:15 Re: DROP TABLE and autovacuum
Previous Message Tom Lane 2007-06-13 13:36:46 Re: comparing index columns

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-06-13 13:51:15 Re: DROP TABLE and autovacuum
Previous Message ITAGAKI Takahiro 2007-06-13 06:28:51 DROP TABLE and autovacuum