Re: VACUUM optimization ideas.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alfred Perlstein <bright(at)wintelcom(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: VACUUM optimization ideas.
Date: 2000-10-12 18:58:42
Message-ID: 200010121858.OAA10485@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Here's two ideas I had for optimizing vacuum, I apologize in advance
> if the ideas presented here are niave and don't take into account
> the actual code that makes up postgresql.
>
> ================
>
> #1
>
> Reducing the time vacuum must hold an exlusive lock on a table:
>
> The idea is that since rows are marked deleted it's ok for the
> vacuum to fill them with data from the tail of the table as
> long as no transaction is in progress that has started before
> the row was deleted.
>
> This may allow the vacuum process to copyback all the data without
> a lock, when all the copying is done it then aquires an exlusive lock
> and does this:
>
> Aquire an exclusive lock.
> Walk all the deleted data marking it as current.
> Truncate the table.
> Release the lock.
>
> Since the data is still marked invalid (right?) even if valid data
> is copied into the space it should be ignored as long as there's no
> transaction occurring that started before the data was invalidated.

Added to TODO:

* Reduce VACUUM lock time by moving tuples with read lock, then write
lock and truncate table [vacuum]

The read-lock is required because other transactions must be prevented
from modifying the rows, and the index is also an issue.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-10-12 19:14:11 Re: pg_dump possible fix, need testers. (was: Re: pg_dump disaster)
Previous Message Bruce Momjian 2000-10-12 18:57:55 Re: VACUUM optimization ideas.