PostgreSQL/解析

CLOG

1 byte = 4トランザクション
8192 byte x 4 = 32768 = 32k トランザクション

clog.png

トランザクションのステータス

ステータス
TRANSACTION_STATUS_IN_PROGRESS0x00
TRANSACTION_STATUS_COMMITTED0x01
TRANSACTION_STATUS_ABORTED0x02
TRANSACTION_STATUS_SUB_COMMITTED0x03

参考

共有メモリ上の構造

/*
 * Number of shared CLOG buffers.
 *
 * On larger multi-processor systems, it is possible to have many CLOG page
 * requests in flight at one time which could lead to disk access for CLOG
 * page if the required page is not found in memory.  Testing revealed that we
 * can get the best performance by having 128 CLOG buffers, more than that it
 * doesn't improve performance.
 *
 * Unconditionally keeping the number of CLOG buffers to 128 did not seem like
 * a good idea, because it would increase the minimum amount of shared memory
 * required to start, which could be a problem for people running very small
 * configurations.  The following formula seems to represent a reasonable
 * compromise: people with very low values for shared_buffers will get fewer
 * CLOG buffers as well, and everyone else will get 128.
 */
Size
CLOGShmemBuffers(void)
{
	return Min(128, Max(4, NBuffers / 512));
}

例えば、shared_buffers = 1024Mとした場合、NBuffersは131072となるが、Min(128, ...)となるため、128となる。
よって、共有メモリ上のバッファにのる最大のトランザクション数は以下となる。

8192 * 4 * 128 = 4162048

CLOGファイル

共有メモリ上のトランザクションxidのコミットステータス位置

参考

例:xid=1052757の場合

CLOG_XACTS_PER_PAGE = 8192 * 4 = 32768
pageno = TransactionIdToPage(xid) = 1052757 / 32768 = 32
byteno = TransactionIdToByte(xid) = TransactionIdToPgIndex(xid) / 4 = (1052757 % 32768) / 4 = 1045
bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT = (1052757 % 4) * 2 = 2

参考リンク


添付ファイル: fileclog.png 138件 [詳細]

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
目次
ダブルクリックで閉じるTOP | 閉じる
GO TO TOP