ETL包的执行时间-脚本
Execution time of ETL packages - script
我使用下面的脚本来计算 ETL 包的执行时间:
DECLARE @DATE DATE = GETDATE() - 7
SELECT
[folder_name]
,[project_name]
,[package_name]
,CAST([start_time] AS datetime) AS [start_time]
,DATEDIFF(minute, [start_time], [end_time]) AS 'execution_time[min]'
FROM [SSISDB].[internal].[execution_info]
WHERE start_time >= @DATE
ORDER BY [start_time]
是否可以提高粒度级别?我想知道每个 ETL 块的执行时间。
可以。以下查询应该 return 每个可执行文件的持续时间。
DECLARE @DATE DATE = GETDATE() - 7
SELECT [executions].[folder_name]
, [executions].[project_name]
, [executions].[package_name]
, [executable_statistics].[execution_path]
, DATEDIFF(minute, [executable_statistics].[start_time], [executable_statistics].[end_time]) AS 'execution_time[min]'
FROM [SSISDB].[catalog].[executions]
INNER JOIN [SSISDB].[catalog].[executable_statistics]
ON [executions].[execution_id] = [executable_statistics].[execution_id]
WHERE [executions].[start_time] >= @DATE
ORDER BY [executable_statistics].[start_time]
您可以在 SSISDB 目录中找到有关不同视图的更多信息 here。
另一个解决方案:
Use SSISDB
DECLARE @DATE DATE = GETDATE() -7
SELECT
CAST(MSG.message_time AS datetime) AS message_time
,CASE message_source_type
WHEN 10 THEN 'Entry APIs, such as T-SQL and CLR Stored procedures'
WHEN 20 THEN 'External process used to run package (ISServerExec.exe)'
WHEN 30 THEN 'Package-level objects'
WHEN 40 THEN 'Control Flow tasks'
WHEN 50 THEN 'Control Flow containers'
WHEN 60 THEN 'Data Flow task'
END AS message_source_type
,CAST(start_time AS datetime) AS start_time
,OPR.object_name
,LEFT(message, CHARINDEX(':', message) -1) AS Block
,CONVERT(TIME(0), LEFT(RIGHT(message, 13),12)) AS execution_time
FROM catalog.operation_messages AS MSG
INNER JOIN catalog.operations AS OPR
ON OPR.operation_id = MSG.operation_id
WHERE
start_time > @DATE
and message like '%:Finish%'
and message not like 'INSERT Record SQL Task:Finished%'
and message_source_type <> 30
and message_source_type <> 50
--ORDER BY message_time DESC
ORDER BY execution_time DESC
我使用下面的脚本来计算 ETL 包的执行时间:
DECLARE @DATE DATE = GETDATE() - 7
SELECT
[folder_name]
,[project_name]
,[package_name]
,CAST([start_time] AS datetime) AS [start_time]
,DATEDIFF(minute, [start_time], [end_time]) AS 'execution_time[min]'
FROM [SSISDB].[internal].[execution_info]
WHERE start_time >= @DATE
ORDER BY [start_time]
是否可以提高粒度级别?我想知道每个 ETL 块的执行时间。
可以。以下查询应该 return 每个可执行文件的持续时间。
DECLARE @DATE DATE = GETDATE() - 7
SELECT [executions].[folder_name]
, [executions].[project_name]
, [executions].[package_name]
, [executable_statistics].[execution_path]
, DATEDIFF(minute, [executable_statistics].[start_time], [executable_statistics].[end_time]) AS 'execution_time[min]'
FROM [SSISDB].[catalog].[executions]
INNER JOIN [SSISDB].[catalog].[executable_statistics]
ON [executions].[execution_id] = [executable_statistics].[execution_id]
WHERE [executions].[start_time] >= @DATE
ORDER BY [executable_statistics].[start_time]
您可以在 SSISDB 目录中找到有关不同视图的更多信息 here。
另一个解决方案:
Use SSISDB
DECLARE @DATE DATE = GETDATE() -7
SELECT
CAST(MSG.message_time AS datetime) AS message_time
,CASE message_source_type
WHEN 10 THEN 'Entry APIs, such as T-SQL and CLR Stored procedures'
WHEN 20 THEN 'External process used to run package (ISServerExec.exe)'
WHEN 30 THEN 'Package-level objects'
WHEN 40 THEN 'Control Flow tasks'
WHEN 50 THEN 'Control Flow containers'
WHEN 60 THEN 'Data Flow task'
END AS message_source_type
,CAST(start_time AS datetime) AS start_time
,OPR.object_name
,LEFT(message, CHARINDEX(':', message) -1) AS Block
,CONVERT(TIME(0), LEFT(RIGHT(message, 13),12)) AS execution_time
FROM catalog.operation_messages AS MSG
INNER JOIN catalog.operations AS OPR
ON OPR.operation_id = MSG.operation_id
WHERE
start_time > @DATE
and message like '%:Finish%'
and message not like 'INSERT Record SQL Task:Finished%'
and message_source_type <> 30
and message_source_type <> 50
--ORDER BY message_time DESC
ORDER BY execution_time DESC