Re: CPU-intensive autovacuuming

From: "Matthew T(dot) O'Connor" <matthew(at)zeut(dot)net>
To: Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CPU-intensive autovacuuming
Date: 2005-06-07 15:16:06
Message-ID: 42A5BA36.6060103@zeut.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Phil Endecott wrote:

> Matthew T. O'Connor wrote:
>
>> Indeed you have. I have head a few similar reports but perhaps none
>> as bad as yours. One person put a small sleep value so that it
>> doesn't spin so tight. You could also just up the sleep delay so
>> that it doesn't do this work quite so often. No other quick
>> suggestions.
>
>
> I do wonder why autovacuum is keeping its table list in memory rather
> than in the database.

For better or worse, this was a conscious design decision that the
contrib version of autovacuum be non-invasive to your database.

> But given that it is keeping it in memory, I think the real fix is to
> sort that list (or keep it ordered when building or updating it). It
> is trivial to also get the query results ordered, and they can then be
> compared in O(n) time.

I'm quite sure there is a better way, please submit a patch if you can.
This was never a real concern for most people since the number of tables
is typically small enough not to be a problem. The integrated version
of autovacuum that didn't make the cut before 8.0 avoids this problem
since the autovacuum data is stored in the database.

> I notice various other places where there seem to be nested loops,
> e.g. in the update_table_list function. I'm not sure if they can be
> fixed by similar means.

I would think so, they all basically do the same type of loop.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2005-06-07 15:17:52 Password authentication failed for user
Previous Message Jochem van Dieten 2005-06-07 15:12:35 Re: pg_dump 8.0.3 failing against PostgreSQL 7.3.2

Browse pgsql-hackers by date

  From Date Subject
Next Message Phil Endecott 2005-06-07 15:35:31 Re: CPU-intensive autovacuuming
Previous Message Tom Lane 2005-06-07 15:10:37 Re: RESET CONNECTION idea