アクティブなインメモリOLTPトランザクションの一覧を出力するSQL Server動的管理ビューレファレンス(130)

「Microsoft SQL Server」が稼働するデータベースシステムを運用する管理者に向け、「動的管理ビュー」の活用を軸にしたトラブル対策のためのノウハウを紹介していきます。今回は、アクティブなインメモリOLTPトランザクションの一覧を出力する方法について解説します。

» 2022年07月25日 05時00分 公開
[伊東敏章@IT]

この記事は会員限定です。会員登録(無料)すると全てご覧いただけます。

SQL Server動的管理ビュー一覧

 本連載では、「Microsoft SQL Server(以下、SQL Server)」で使用可能な動的管理ビューについて、動作概要や出力内容などを紹介していきます。今回は動的管理ビュー「sys.dm_db_xtp_transactions」における、アクティブなインメモリOLTPトランザクションの一覧を出力する方法について解説します。対応バージョンは、SQL Server(サポートされている全てのバージョン)、「Azure SQL Database」「Azure SQL Managed Instance」です。

概要

 SQL ServerではインメモリOLTPを使用することで、トランザクション処理やデータ取得、データロード、一時データ・シナリオのパフォーマンスを最適化できます。インメモリOLTPにおけるデータアクセスやトランザクションの実行は、従来のディスクベースのオブジェクトとは異なるアルゴリズムで処理されます。

 「sys.dm_db_xtp_transactions」動的管理ビューを出力することで、現在アクティブなインメモリOLTPトランザクションの一覧を確認できます。

出力内容

列名 データ型 説明
xtp_transaction_id bigint このトランザクションのXTPトランザクションマネジャーでの内部ID
transaction_id bigint 他のトランザクション関連のDMV(「sys.dm_tran_active_transactions」など)と結合できるトランザクションID。XTPのみのトランザクションの場合は「0」
session_id smallint このトランザクションを実行しているセッションID
begin_tsn bigint トランザクションの開始TSN(トランザクションのシリアル番号)
end_tsn bigint トランザクションの終了TSN(トランザクションのシリアル番号)
state int トランザクションの状態
 「0」=ACTIVE
 「1」=COMMITTED
 「2」=ABORTED
 「3」=VALIDATING
state_desc nvarchar(16) 「state」の説明
result int このトランザクションの結果
 「0」=IN PROGRESS
 「1」=SUCCESS
 「2」=ERROR
 「3」=COMMIT DEPENDENCY
 「4」=VALIDATION FAILED(RR)
 「5」=VALIDATION FAILED(SR)
 「6」=ROLLBACK
result_desc nvarchar(24) 「result」の説明
last_error int 内部使用のみ
is_speculative bit 内部使用のみ
is_prepared bit 内部使用のみ
is_delayed_durability bit 内部使用のみ
memory_address varbinary(8) 内部使用のみ
database_address varbinary(8) 内部使用のみ
thread_id int 内部使用のみ
read_set_row_count int 内部使用のみ
write_set_row_count int 内部使用のみ
scan_set_count int 内部使用のみ
savepoint_garbage_count int 内部使用のみ
log_bytes_required bigint 内部使用のみ
count_of_allocations int 内部使用のみ
allocated_bytes int 内部使用のみ
reserved_bytes int 内部使用のみ
commit_dependency_count int 内部使用のみ
commit_dependency_total_attempt_count int 内部使用のみ
scan_area int 内部使用のみ
scan_area_desc nvarchar(16) 内部使用のみ
scan_location int 内部使用のみ
dependent_1_address varbinary(8) 内部使用のみ
dependent_2_address varbinary(8) 内部使用のみ
dependent_3_address varbinary(8) 内部使用のみ
dependent_4_address varbinary(8) 内部使用のみ
dependent_5_address varbinary(8) 内部使用のみ
dependent_6_address varbinary(8) 内部使用のみ
dependent_7_address varbinary(8) 内部使用のみ
dependent_8_address varbinary(8) 内部使用のみ

動作例

Copyright © ITmedia, Inc. All Rights Reserved.

RSSについて

アイティメディアIDについて

メールマガジン登録

@ITのメールマガジンは、 もちろん、すべて無料です。ぜひメールマガジンをご購読ください。