@PackageSourceID is the ID of the package being executed.
@listsize is the size of the record set being processed.
The package must have logging enabled, and the package must have OnPreExecute and OnPostExecute logged.
DECLARE
@PackageSourceID VARCHAR(255)
SET
@PackageSourceID = '2142F02C-907D-47A0-B3A5-E0BAC8CB5AEC'
DECLARE @listsize INT
SET @listsize = 1000000;
WITH
cte_startend
AS (SELECT *
FROM sysssislog
WHERE executionid IN (SELECT executionid
FROM
sysssislog
WHERE sourceid
= @PackageSourceID)
--where
executionid = @ExecutionID
),
preexecute
AS (SELECT *
FROM cte_startend a
WHERE event = 'OnPreExecute'),
postexecute
AS (SELECT *
FROM cte_startend a
WHERE event = 'OnPostExecute'),
executetime
AS (SELECT Datediff (ms, pe.starttime, poe.endtime) AS executetime,
pe.id,
pe.source,
pe.starttime,
pe.endtime,
pe.sourceid,
pe.executionid
FROM preexecute pe
JOIN
postexecute poe
ON
pe.sourceid =
poe.sourceid
AND
pe.executionid =
poe.executionid
and
pe.sourceid not
in (@PackageSourceID)
)
--@listsize
SELECT
executionid,
@listsize /
executetime AS rowsperms,
*
FROM executetime et
ORDER BY et.executionid DESC,
@listsize /
executetime DESC
No comments:
Post a Comment