sys.dm_exec_procedure_stats (Transact-sql)sys.dm_exec_procedure_stats (Transact-SQL)
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
キャッシュされたストアド プロシージャの集計パフォーマンス統計を返します。Returns aggregate performance statistics for cached stored procedures. ビューは、キャッシュされたストアド プロシージャのプランごとに 1 行を返します。その行の有効期間はストアド プロシージャがキャッシュに残っている間になります。The view returns one row for each cached stored procedure plan, and the lifetime of the row is as long as the stored procedure remains cached. つまり、ストアド プロシージャがキャッシュから削除されると、対応する行もこのビューから削除されます。When a stored procedure 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.
Azure SQL データベースAzure SQL Database では、動的管理ビューは、データベースの包含に影響する情報を公開することも、ユーザーがアクセスできる他のデータベースに関する情報を公開することもできません。In Azure SQL データベースAzure SQL 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.
注意
データには完了したクエリだけが反映され、まだ処理中ではないため、 sys.dm_exec_procedure_stats の結果は実行ごとに異なる場合があります。The results of sys.dm_exec_procedure_stats may vary with each execution as the data only reflects finished queries, and not ones still in-flight. またはからこれを呼び出すに Azure Synapse AnalyticsAzure Synapse Analytics は Parallel Data WarehouseParallel Data Warehouse 、 sys.dm_pdw_nodes_exec_procedure_stats という名前を使用します。To call this from Azure Synapse AnalyticsAzure Synapse Analytics or Parallel Data WarehouseParallel Data Warehouse, use the name sys.dm_pdw_nodes_exec_procedure_stats.
列名Column name | データ型Data type | 説明Description |
---|---|---|
database_iddatabase_id | intint | ストアド プロシージャが存在するデータベースの ID。Database ID in which the stored procedure resides. |
object_idobject_id | intint | ストアド プロシージャのオブジェクト ID 番号。Object identification number of the stored procedure. |
typetype | char(2)char(2) | 次のいずれかのオブジェクトの種類。Type of the object: P = SQL ストアド プロシージャP = SQL stored procedure PC = アセンブリ (CLR) ストアド プロシージャPC = Assembly (CLR) stored procedure X = 拡張ストアド プロシージャX = Extended stored procedure |
type_desctype_desc | nvarchar(60)nvarchar(60) | オブジェクトの種類の説明。Description of the object type: SQL_STORED_PROCEDURESQL_STORED_PROCEDURE CLR_STORED_PROCEDURECLR_STORED_PROCEDURE EXTENDED_STORED_PROCEDUREEXTENDED_STORED_PROCEDURE |
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 stored procedure. |
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. ネイティブ コンパイル ストアド プロシージャがメモリ最適化テーブルに対してクエリを実行するときは、常に 0x000 になります。Will always be 0x000 when a natively compiled stored procedure queries a memory-optimized table. |
cached_timecached_time | datetimedatetime | ストアド プロシージャがキャッシュに追加された時刻。Time at which the stored procedure was added to the cache. |
last_execution_timelast_execution_time | datetimedatetime | 前回ストアド プロシージャが実行された時刻。Last time at which the stored procedure was executed. |
execution_countexecution_count | bigintbigint | ストアドプロシージャが最後にコンパイルされてから実行された回数。The number of times that the stored procedure 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 stored procedure since it was compiled. ネイティブ コンパイル ストアド プロシージャに関して、多くの実行が 1 ミリ秒未満である場合は、 total_worker_time は精度が高くない可能性があります。For natively compiled stored procedures, total_worker_time may not be accurate if many executions take less than 1 millisecond. |
last_worker_timelast_worker_time | bigintbigint | ストアド プロシージャを前回実行したときに使用された CPU 時間 (マイクロ秒単位)。CPU time, in microseconds, that was consumed the last time the stored procedure was executed. 11 |
min_worker_timemin_worker_time | bigintbigint | このストアドプロシージャが1回の実行で使用した最小 CPU 時間 (マイクロ秒単位)。The minimum CPU time, in microseconds, that this stored procedure has ever consumed during a single execution. 11 |
max_worker_timemax_worker_time | bigintbigint | このストアドプロシージャが1回の実行で使用した最大 CPU 時間 (マイクロ秒単位)。The maximum CPU time, in microseconds, that this stored procedure has ever consumed during a single execution. 11 |
total_physical_readstotal_physical_reads | bigintbigint | コンパイル後にこのストアドプロシージャの実行で行われた物理読み取りの合計数。The total number of physical reads performed by executions of this stored procedure since it was compiled. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
last_physical_readslast_physical_reads | bigintbigint | ストアドプロシージャが最後に実行されたときに実行された物理読み取りの数。The number of physical reads performed the last time the stored procedure was executed. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
min_physical_readsmin_physical_reads | bigintbigint | このストアドプロシージャの1回の実行で行われた物理読み取りの最小数。The minimum number of physical reads that this stored procedure has ever performed during a single execution. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
max_physical_readsmax_physical_reads | bigintbigint | このストアドプロシージャの1回の実行で行われた物理読み取りの最大数。The maximum number of physical reads that this stored procedure has ever performed during a single execution. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
total_logical_writestotal_logical_writes | bigintbigint | コンパイル後にこのストアドプロシージャの実行によって実行された論理書き込みの合計数。The total number of logical writes performed by executions of this stored procedure since it was compiled. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
last_logical_writeslast_logical_writes | bigintbigint | プランが最後に実行されたときにダーティしたバッファープールページの数。The number of buffer pool pages dirtied the last time the plan was executed. ページが既にダーティの場合 (変更された場合)、書き込みはカウントされません。If a page is already dirty (modified) no writes are counted. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
min_logical_writesmin_logical_writes | bigintbigint | このストアドプロシージャの1回の実行で行われた論理書き込みの最小数。The minimum number of logical writes that this stored procedure has ever performed during a single execution. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
max_logical_writesmax_logical_writes | bigintbigint | このストアドプロシージャの1回の実行で行われた論理書き込みの最大数。The maximum number of logical writes that this stored procedure has ever performed during a single execution. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
total_logical_readstotal_logical_reads | bigintbigint | コンパイル後にこのストアドプロシージャの実行によって実行された論理読み取りの合計数。The total number of logical reads performed by executions of this stored procedure since it was compiled. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
last_logical_readslast_logical_reads | bigintbigint | ストアドプロシージャが最後に実行されたときに実行された論理読み取りの数。The number of logical reads performed the last time the stored procedure was executed. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
min_logical_readsmin_logical_reads | bigintbigint | このストアドプロシージャの1回の実行で行われた論理読み取りの最小数。The minimum number of logical reads that this stored procedure has ever performed during a single execution. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
max_logical_readsmax_logical_reads | bigintbigint | このストアドプロシージャの1回の実行で行われた論理読み取りの最大数。The maximum number of logical reads that this stored procedure has ever performed during a single execution. は常にメモリ最適化テーブルを照会する0になります。Will always be 0 querying a memory-optimized table. |
total_elapsed_timetotal_elapsed_time | bigintbigint | このストアドプロシージャの実行完了までの経過時間の合計 (マイクロ秒単位)。The total elapsed time, in microseconds, for completed executions of this stored procedure. |
last_elapsed_timelast_elapsed_time | bigintbigint | このストアドプロシージャの前回の実行完了までの経過時間 (マイクロ秒単位)。The elapsed time, in microseconds, for the most recently completed execution of this stored procedure. |
min_elapsed_timemin_elapsed_time | bigintbigint | このストアドプロシージャの実行完了までの最小経過時間 (マイクロ秒単位)。The minimum elapsed time, in microseconds, for any completed execution of this stored procedure. |
max_elapsed_timemax_elapsed_time | bigintbigint | このストアドプロシージャの実行完了までの最大経過時間 (マイクロ秒単位)。The maximum elapsed time, in microseconds, for any completed execution of this stored procedure. |
total_spillstotal_spills | bigintbigint | コンパイル後にこのストアドプロシージャの実行によって書き込まれたページの合計数。The total number of pages spilled by execution of this stored procedure 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 stored procedure 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 stored procedure 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 stored procedure 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 |
pdw_node_idpdw_node_id | intint | このディストリビューションが配置されているノードの識別子。The identifier for the node that this distribution is on. 適用対象: Azure Synapse AnalyticsAzure Synapse Analytics 、 Parallel Data WarehouseParallel Data WarehouseApplies to: Azure Synapse AnalyticsAzure Synapse Analytics, Parallel Data WarehouseParallel Data Warehouse |
total_page_server_readstotal_page_server_reads | bigintbigint | コンパイル後にこのストアドプロシージャの実行によって実行されたページサーバー読み取りの合計数。The total number of page server reads performed by executions of this stored procedure 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 stored procedure 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 stored procedure 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 stored procedure has ever performed during a single execution. 適用対象: Azure SQL Database ハイパースケールApplies to: Azure SQL Database Hyperscale |
1 ネイティブコンパイルストアドプロシージャの統計コレクションが有効になっている場合、ワーカー時間はミリ秒単位で収集されます。1 For natively compiled stored procedures when statistics collection is enabled, worker time is collected in milliseconds. クエリが 1 ミリ秒未満で実行された場合は、値は 0 になります。If the query executes in less than a millisecond, the value will be 0.
アクセス許可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.
解説Remarks
ビュー内の統計は、ストアド プロシージャの実行が完了したときに更新されます。Statistics in the view are updated when a stored procedure execution completes.
例Examples
次の例では、平均経過時間で識別される上位 10 個のストアド プロシージャに関する情報を返します。The following example returns information about the top ten stored procedures identified by average elapsed time.
SELECT TOP 10 d.object_id, d.database_id, OBJECT_NAME(object_id, database_id) 'proc 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_procedure_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_plan (Transact-sql) sys.dm_exec_query_plan (Transact-SQL)
sys.dm_exec_query_stats (Transact-sql) sys.dm_exec_query_stats (Transact-SQL)
sys.dm_exec_trigger_stats (Transact-sql) sys.dm_exec_trigger_stats (Transact-SQL)
sys.dm_exec_cached_plans (Transact-SQL)sys.dm_exec_cached_plans (Transact-SQL)