From: Alvaro Herrera <alvherre@commandprompt.com>
To: Greg Smith <gsmith@gregsmith.com>
Cc: Matthew Wakeling <matthew@flymine.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: I/O on select count(*)
Date: Fri, 16 May 2008 16:15:28 -0400
Message-ID: <20080516201528.GJ13061@alvh.no-ip.org> (raw)
In-Reply-To: <Pine.GSO.4.64.0805161118210.4987@westnet.com>
References: <920841.71690.qm@web44808.mail.sp1.yahoo.com>
<482B1D5F.EE98.0025.0@wicourts.gov>
<Pine.GSO.4.64.0805142133250.27290@westnet.com>
<20080515020553.GN9838@alvh.no-ip.org>
<Pine.LNX.4.64.0805151245360.16756@aragorn.flymine.org>
<20080515155232.GC8221@alvh.no-ip.org>
<Pine.GSO.4.64.0805161118210.4987@westnet.com>
Greg Smith wrote:
> After reading the code and that documentation a bit, the part I'm still
> not sure about is whether the CLOG entry is created when the XID is
> assigned and then kept current as the state changes, or whether that
> isn't even in CLOG until the transaction is committed. It seems like the
> latter, but there's some ambiguity in the wording and too many code paths
> for me to map right now.
pg_clog is allocated in pages of 8kB apiece(*). On allocation, pages are
zeroed, which is the bit pattern for "transaction in progress". So when
a transaction starts, it only needs to ensure that the pg_clog page that
corresponds to it is allocated, but it need not write anything to it.
(*) Each transaction needs 2 bits, so on a 8 kB page there is space for
4 transactions/byte * 8 pages * 1kB/page = 32k transactions.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: alvherre@commandprompt.com, gsmith@gregsmith.com, matthew@flymine.org
Subject: Re: I/O on select count(*)
In-Reply-To: <20080516201528.GJ13061@alvh.no-ip.org>
References: <920841.71690.qm@web44808.mail.sp1.yahoo.com> <482B1D5F.EE98.0025.0@wicourts.gov> <Pine.GSO.4.64.0805142133250.27290@westnet.com> <20080515020553.GN9838@alvh.no-ip.org> <Pine.LNX.4.64.0805151245360.16756@aragorn.flymine.org> <20080515155232.GC8221@alvh.no-ip.org> <Pine.GSO.4.64.0805161118210.4987@westnet.com> <20080516201528.GJ13061@alvh.no-ip.org>
* 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