sys.dm_exec_trigger_stats (Transact-SQL)sys.dm_exec_trigger_stats (Transact-SQL)
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
キャッシュされたトリガーの集計パフォーマンス統計を返します。Returns aggregate performance statistics for cached triggers. このビューには、トリガーごとに 1 行が含まれており、その行の有効期間はトリガーがキャッシュに残っている間です。The view contains one row per trigger, and the lifetime of the row is as long as the trigger remains cached. つまり、トリガーがキャッシュから削除されると、対応する行もこのビューから削除されます。When a trigger is removed from the cache, the corresponding row is eliminated from this view. その時点で、sys.dm_exec_query_stats と同様にパフォーマンス統計 SQL トレース イベントが発生します。At that time, a Performance Statistics SQL trace event is raised similar to sys.dm_exec_query_stats.
列名Column name | データ型Data type | 説明Description |
---|---|---|
database_iddatabase_id | intint | トリガーが存在するデータベースの ID。Database ID in which the trigger resides. |
object_idobject_id | intint | トリガーのオブジェクト ID 番号。Object identification number of the trigger. |
typetype | char(2)char(2) | 次のいずれかのオブジェクトの種類。Type of the object: TA = アセンブリ (CLR) トリガーTA = Assembly (CLR) trigger TR = SQL トリガーTR = SQL trigger |
Type_descType_desc | nvarchar(60)nvarchar(60) | オブジェクトの種類の説明。Description of the object type: CLR_TRIGGERCLR_TRIGGER SQL_TRIGGERSQL_TRIGGER |
sql_handlesql_handle | varbinary(64)varbinary(64) | これを使用すると、このトリガー内から実行された sys.dm_exec_query_stats 内のクエリと関連付けることができます。This can be used to correlate with queries in sys.dm_exec_query_stats that were executed from within this trigger. |
plan_handleplan_handle | varbinary(64)varbinary(64) | インメモリ プランの識別子。Identifier for the in-memory plan. この識別子は一時的なもので、プランがキャッシュに残っている間だけ一定の値になります。This identifier is transient and remains constant only while the plan remains in the cache. この値は、 sys.dm_exec_cached_plans 動的管理ビューで使用できます。This value may be used with the sys.dm_exec_cached_plans dynamic management view. |
cached_timecached_time | datetimedatetime | トリガーがキャッシュに追加された時刻。Time at which the trigger was added to the cache. |
last_execution_timelast_execution_time | datetimedatetime | 前回トリガーが実行された時刻。Last time at which the trigger was executed. |
execution_countexecution_count | bigintbigint | トリガーが最後にコンパイルされてから実行された回数。The number of times that the trigger has been executed since it was last compiled. |
total_worker_timetotal_worker_time | bigintbigint | コンパイル後にこのトリガーの実行で消費された CPU 時間の合計 (マイクロ秒単位)。The total amount of CPU time, in microseconds, that was consumed by executions of this trigger since it was compiled. |
last_worker_timelast_worker_time | bigintbigint | トリガーを前回実行したときに使用された CPU 時間 (マイクロ秒単位)。CPU time, in microseconds, that was consumed the last time the trigger was executed. |
min_worker_timemin_worker_time | bigintbigint | このトリガーが1回の実行で消費した最大 CPU 時間 (マイクロ秒単位)。The maximum CPU time, in microseconds, that this trigger has ever consumed during a single execution. |
max_worker_timemax_worker_time | bigintbigint | このトリガーが1回の実行で消費した最大 CPU 時間 (マイクロ秒単位)。The maximum CPU time, in microseconds, that this trigger has ever consumed during a single execution. |
total_physical_readstotal_physical_reads | bigintbigint | コンパイル後にこのトリガーの実行で行われた物理読み取りの合計数。The total number of physical reads performed by executions of this trigger since it was compiled. |
last_physical_readslast_physical_reads | bigintbigint | トリガーを前回実行したときに実行された物理読み取りの数。The number of physical reads performed the last time the trigger was executed. |
min_physical_readsmin_physical_reads | bigintbigint | このトリガーの1回の実行で行われた物理読み取りの最小数。The minimum number of physical reads that this trigger has ever performed during a single execution. |
max_physical_readsmax_physical_reads | bigintbigint | このトリガーの1回の実行で行われた物理読み取りの最大数。The maximum number of physical reads that this trigger has ever performed during a single execution. |
total_logical_writestotal_logical_writes | bigintbigint | コンパイル後にこのトリガーの実行によって実行された論理書き込みの合計数。The total number of logical writes performed by executions of this trigger since it was compiled. |
last_logical_writeslast_logical_writes | bigintbigint | トリガーが最後に実行されたときに実行された論理書き込みの数。The number of logical writes performed the last time the trigger was executed. |
min_logical_writesmin_logical_writes | bigintbigint | このトリガーの1回の実行で行われた論理書き込みの最小数。The minimum number of logical writes that this trigger has ever performed during a single execution. |
max_logical_writesmax_logical_writes | bigintbigint | このトリガーの1回の実行で行われた論理書き込みの最大数。The maximum number of logical writes that this trigger has ever performed during a single execution. |
total_logical_readstotal_logical_reads | bigintbigint | コンパイル後にこのトリガーの実行で行われた論理読み取りの合計数。The total number of logical reads performed by executions of this trigger since it was compiled. |
last_logical_readslast_logical_reads | bigintbigint | トリガーが最後に実行されたときに実行された論理読み取りの数。The number of logical reads performed the last time the trigger was executed. |
min_logical_readsmin_logical_reads | bigintbigint | このトリガーの1回の実行で行われた論理読み取りの最小数。The minimum number of logical reads that this trigger has ever performed during a single execution. |
max_logical_readsmax_logical_reads | bigintbigint | このトリガーの1回の実行で行われた論理読み取りの最大数。The maximum number of logical reads that this trigger has ever performed during a single execution. |
total_elapsed_timetotal_elapsed_time | bigintbigint | このトリガーの実行完了までの経過時間の合計 (マイクロ秒単位)。The total elapsed time, in microseconds, for completed executions of this trigger. |
last_elapsed_timelast_elapsed_time | bigintbigint | このトリガーの前回の実行完了までの経過時間 (マイクロ秒単位)。Elapsed time, in microseconds, for the most recently completed execution of this trigger. |
min_elapsed_timemin_elapsed_time | bigintbigint | このトリガーの実行完了までの最小経過時間 (マイクロ秒単位)。The minimum elapsed time, in microseconds, for any completed execution of this trigger. |
max_elapsed_timemax_elapsed_time | bigintbigint | このトリガーの実行完了までの最大経過時間 (マイクロ秒単位)。The maximum elapsed time, in microseconds, for any completed execution of this trigger. |
total_spillstotal_spills | bigintbigint | コンパイル後にこのトリガーの実行によって書き込まれたページの合計数。The total number of pages spilled by execution of this trigger since it was compiled. 適用対象: CU3 以降 SQL Server 2017 (14.x)SQL Server 2017 (14.x)Applies to: Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3 |
last_spillslast_spills | bigintbigint | 最後にトリガーが実行されたときに書き込まれたページの数。The number of pages spilled the last time the trigger was executed. 適用対象: CU3 以降 SQL Server 2017 (14.x)SQL Server 2017 (14.x)Applies to: Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3 |
min_spillsmin_spills | bigintbigint | このトリガーによって1回の実行中に書き込まれたページの最小数。The minimum number of pages that this trigger has ever spilled during a single execution. 適用対象: CU3 以降 SQL Server 2017 (14.x)SQL Server 2017 (14.x)Applies to: Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3 |
max_spillsmax_spills | bigintbigint | このトリガーによって1回の実行中に書き込まれたページの最大数。The maximum number of pages that this trigger has ever spilled during a single execution. 適用対象: CU3 以降 SQL Server 2017 (14.x)SQL Server 2017 (14.x)Applies to: Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3 |
total_page_server_readstotal_page_server_reads | bigintbigint | コンパイル後にこのトリガーの実行によって実行されたページサーバー読み取りの合計数。The total number of page server reads performed by executions of this trigger since it was compiled. 適用対象: Azure SQL Database ハイパースケールApplies to: Azure SQL Database Hyperscale |
last_page_server_readslast_page_server_reads | bigintbigint | 最後にトリガーを実行したときに実行されたページサーバーの読み取り回数。The number of page server reads performed the last time the trigger was executed. 適用対象: Azure SQL Database ハイパースケールApplies to: Azure SQL Database Hyperscale |
min_page_server_readsmin_page_server_reads | bigintbigint | このトリガーの1回の実行で行われた、ページサーバーの読み取りの最小数。The minimum number of page server reads that this trigger has ever performed during a single execution. 適用対象: Azure SQL Database ハイパースケールApplies to: Azure SQL Database Hyperscale |
max_page_server_readsmax_page_server_reads | bigintbigint | このトリガーの1回の実行で行われた、ページサーバーの読み取りの最大数。The maximum number of page server reads that this trigger has ever performed during a single execution. 適用対象: Azure SQL Database ハイパースケールApplies to: Azure SQL Database Hyperscale |
解説Remarks
SQL DatabaseSQL Database では、動的管理ビューは、データベースの包含に影響する情報を公開することも、ユーザーがアクセスできる他のデータベースに関する情報を公開することもできません。In SQL DatabaseSQL Database, dynamic management views cannot expose information that would impact database containment or expose information about other databases the user has access to. この情報を公開しないように、接続されたテナントに属していないデータを含むすべての行がフィルターで除外されます。To avoid exposing this information, every row that contains data that doesn't belong to the connected tenant is filtered out.
ビュー内の統計は、クエリが完了したときに更新されます。Statistics in the view are updated when a query is completed.
アクセス許可Permissions
で SQL ServerSQL Server は、 VIEW SERVER STATE
権限が必要です。On SQL ServerSQL Server, requires VIEW SERVER STATE
permission.
SQL Database Basic、S0、S1 のサービス目標、およびエラスティックプール内のデータベースについては、 サーバー管理者 アカウントまたは Azure Active Directory 管理者 アカウントが必要です。On SQL Database Basic, S0, and S1 service objectives, and for databases in elastic pools, the server admin account or the Azure Active Directory admin account is required. その他のすべての SQL Database サービスの目的で VIEW DATABASE STATE
は、データベースで権限が必要になります。On all other SQL Database service objectives, the VIEW DATABASE STATE
permission is required in the database.
例Examples
次の例では、平均経過時間で識別される上位 5 つのトリガーに関する情報を返します。The following example returns information about the top five triggers identified by average elapsed time.
SELECT TOP 5 d.object_id, d.database_id, DB_NAME(database_id) AS 'database_name',
OBJECT_NAME(object_id, database_id) AS 'trigger_name', d.cached_time,
d.last_execution_time, d.total_elapsed_time,
d.total_elapsed_time/d.execution_count AS [avg_elapsed_time],
d.last_elapsed_time, d.execution_count
FROM sys.dm_exec_trigger_stats AS d
ORDER BY [total_worker_time] DESC;
参照See Also
実行関連の動的管理ビューおよび関数 (Transact-sql) Execution Related Dynamic Management Views and Functions (Transact-SQL)
sys.dm_exec_sql_text (Transact-sql) sys.dm_exec_sql_text (Transact-SQL)
sys.dm_exec_query_stats (Transact-sql) sys.dm_exec_query_stats (Transact-SQL)
sys.dm_exec_procedure_stats (Transact-sql) sys.dm_exec_procedure_stats (Transact-SQL)
sys.dm_exec_cached_plans (Transact-SQL)sys.dm_exec_cached_plans (Transact-SQL)