Re: I/O on select count(*)

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: I/O on select count(*)
Дата
Msg-id 20080516201528.GJ13061@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: I/O on select count(*)  (Greg Smith <gsmith@gregsmith.com>)
Ответы Re: I/O on select count(*)  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: I/O on select count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
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.

В списке pgsql-performance по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: very slow left join
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Regexps - never completing join.