Skip site navigation (1) Skip section navigation (2)

pgsql: Make large sequential scans and VACUUMs work in a limited-size

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make large sequential scans and VACUUMs work in a limited-size
Date: 2007-05-30 20:12:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committerspgsql-hackers
Log Message:
Make large sequential scans and VACUUMs work in a limited-size "ring" of
buffers, rather than blowing out the whole shared-buffer arena.  Aside from
avoiding cache spoliation, this fixes the problem that VACUUM formerly tended
to cause a WAL flush for every page it modified, because we had it hacked to
use only a single buffer.  Those flushes will now occur only once per
ring-ful.  The exact ring size, and the threshold for seqscans to switch into
the ring usage pattern, remain under debate; but the infrastructure seems
done.  The key bit of infrastructure is a new optional BufferAccessStrategy
object that can be passed to ReadBuffer operations; this replaces the former
StrategyHintVacuum API.

This patch also changes the buffer usage-count methodology a bit: we now
advance usage_count when first pinning a buffer, rather than when last
unpinning it.  To preserve the behavior that a buffer's lifetime starts to
decrease when it's released, the clock sweep code is modified to not decrement
usage_count of pinned buffers.

Work not done in this commit: teach GiST and GIN indexes to use the vacuum
BufferAccessStrategy for vacuum-driven fetches.

Original patch by Simon, reworked by Heikki and again by Tom.

Modified Files:
        hash.c (r1.94 -> r1.95)
        hashovfl.c (r1.57 -> r1.58)
        hashpage.c (r1.67 -> r1.68)
        heapam.c (r1.233 -> r1.234)
        nbtree.c (r1.154 -> r1.155)
        xlog.c (r1.269 -> r1.270)
        index.c (r1.283 -> r1.284)
        analyze.c (r1.107 -> r1.108)
        vacuum.c (r1.351 -> r1.352)
        vacuumlazy.c (r1.89 -> r1.90)
        autovacuum.c (r1.46 -> r1.47)
        README (r1.11 -> r1.12)
        bufmgr.c (r1.219 -> r1.220)
        freelist.c (r1.58 -> r1.59)
        localbuf.c (r1.76 -> r1.77)
        utility.c (r1.279 -> r1.280)
        genam.h (r1.66 -> r1.67)
        hash.h (r1.80 -> r1.81)
        relscan.h (r1.53 -> r1.54)
        xlog.h (r1.77 -> r1.78)
        vacuum.h (r1.71 -> r1.72)
        buf.h (r1.21 -> r1.22)
        buf_internals.h (r1.89 -> r1.90)
        bufmgr.h (r1.103 -> r1.104)


pgsql-hackers by date

Next:From: Tom LaneDate: 2007-05-30 20:21:02
Subject: Re: Padding on 64-bit
Previous:From: Gregory StarkDate: 2007-05-30 20:07:49
Subject: Re: Style of file error messages

pgsql-committers by date

Next:From: Bruce MomjianDate: 2007-05-30 20:26:07
Subject: pgsql: Update: < * Consider allowing 64-bit integers to be passed by
Previous:From: Bruce MomjianDate: 2007-05-30 20:02:41
Subject: pgsql: Fix wording: < * Consider allowing 64-bit integers to be passed

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group