Re: CPU-intensive autovacuuming

From: Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: CPU-intensive autovacuuming
Date: 2005-06-06 15:16:22
Message-ID: 42A468C6.6040603@chezphil.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Following up on my own post from last night:

> Could it be that there is some code in autovacuum that is O(n^2) in
> the number of tables?

Browsing the code using webcvs, I have found this:

for (j = 0; j < PQntuples(res); j++)
{
tbl_elem = DLGetHead(dbs->table_list);
while (tbl_elem != NULL)
{

I haven't really tried to understand what is going on in here, but it
does look like it is getting the result of the "pg_class join stats"
query and then matching it up against its internal list of tables using
nested loops, which is undoubtedly O(n^2) in the number of tables.

Have I correctly understood what is going on here?

--Phil.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2005-06-06 15:17:24 Re: postgresql books
Previous Message Franco Bruno Borghesi 2005-06-06 15:15:19 Re: return two elements

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonah H. Harris 2005-06-06 15:21:47 Re: PGDN source browser
Previous Message Gevik babakhani 2005-06-06 15:13:50 Re: PGDN source browser