pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Simon Riggs <simon@2ndQuadrant.com>
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Visibility map, partial vacuums
Date: Tue, 28 Oct 2008 17:03:15 +0000
Message-ID: <1225213395.3971.217.camel@ebony.2ndQuadrant> (raw)
In-Reply-To: <4905AE17.7090305@enterprisedb.com>
References: <4905AE17.7090305@enterprisedb.com>
On Mon, 2008-10-27 at 14:03 +0200, Heikki Linnakangas wrote:
> Lazy VACUUM only needs to visit pages that are '0' in the visibility
> map. This allows partial vacuums, where we only need to scan those parts
> of the table that need vacuuming, plus all indexes.
Just realised that this means we still have to visit each block of a
btree index with a cleanup lock.
That means the earlier idea of saying I don't need a cleanup lock if the
page is not in memory makes a lot more sense with a partial vacuum.
1. Scan all blocks in memory for the index (and so, don't do this unless
the index is larger than a certain % of shared buffers),
2. Start reading in new blocks until you've removed the correct number
of tuples
3. Work through the rest of the blocks checking that they are either in
shared buffers and we can get a cleanup lock, or they aren't in shared
buffers and so nobody has them pinned.
If you step (2) intelligently with regard to index correlation you might
not need to do much I/O at all, if any.
(1) has a good hit ratio because mostly only active tables will be
vacuumed so are fairly likely to be in memory.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support
view thread (53+ messages) latest in thread
Message-ID: <1225213395.3971.217.camel@ebony.2ndQuadrant>
Permalink: ../1225213395.3971.217.camel@ebony.2ndQuadrant/
Also on: postgresql.org/message-id/1225213395.3971.217.camel@ebony.2ndQuadrant
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: simon@2ndQuadrant.com, heikki.linnakangas@enterprisedb.com
Subject: Re: Visibility map, partial vacuums
In-Reply-To: <1225213395.3971.217.camel@ebony.2ndQuadrant>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox