Problem
As
you design and deploy more and more reports to your Report Server, how do you
review which reports are being run, how often, and how long the reports take to
render?
Solution
SQL
Server Reporting Services (SSRS) installs a ReportServer database which houses
the nuts and bolts of the Reporting Services Infrastructure. In particular, the
Report Server Database contains the ExecutionLogStorage table. With each run of
a Report Server report, the ExecutionLogStorage table is populated with important
details about the report execution.You can easily navigate to http://msdn.microsoft.com/en-us/library/ms159110(v=sql.105).aspx to review MSDN's description of each of the fields; further Robert Bruckner's ExecutionLog2 View - Analyzing and Optimizing Reports, provides additional details about the view's fields even though it references the ExecutionLog2 view.CREATE VIEW
[dbo].[ExecutionLog3]
AS
SELECT
InstanceName
,
COALESCE
(
C.Path
,
'Unknown'
)
AS
ItemPath
,
UserName
,
ExecutionId
,
CASE
(
RequestType
)
WHEN
0
THEN
'Interactive'
WHEN
1
THEN
'Subscription'
WHEN
2
THEN
'Refresh Cache'
ELSE
'Unknown'
END AS
RequestType
,
-- SubscriptionId,
Format
,
Parameters
,
CASE
(
ReportAction
)
WHEN
1
THEN
'Render'
WHEN
2
THEN
'BookmarkNavigation'
WHEN
3
THEN
'DocumentMapNavigation'
WHEN
4
THEN
'DrillThrough'
WHEN
5
THEN
'FindString'
WHEN
6
THEN
'GetDocumentMap'
WHEN
7
THEN
'Toggle'
WHEN
8
THEN
'Sort'
WHEN
9
THEN
'Execute'
ELSE
'Unknown'
END AS
ItemAction
,
TimeStart
,
TimeEnd
,
TimeDataRetrieval
,
TimeProcessing
,
TimeRendering
,
CASE
(
Source
)
WHEN
1
THEN
'Live'
WHEN
2
THEN
'Cache'
WHEN
3
THEN
'Snapshot'
WHEN
4
THEN
'History'
WHEN
5
THEN
'AdHoc'
WHEN
6
THEN
'Session'
WHEN
7
THEN
'Rdce'
ELSE
'Unknown'
END AS
Source
,
Status
,
ByteCount
,
[RowCount]
,
AdditionalInfo
FROM
ExecutionLogStorage EL
WITH
(
NOLOCK
)
LEFT
OUTER
JOIN
Catalog C
WITH
(
NOLOCK
)
ON
(
EL.ReportID
=
C.ItemID
);
GO
Specifically, the following fields are of note:
- Instance Name -
If you are in a web farm environment, this field will display the exact
instance for the report request.
- ExecutionID -
Identifies the request; however this field is not unique as a request can
have multiple lines in the log for a single request.
- Format - often
this field will be RPL or HTML4.0 as these convey an interactive rendering
of the report (which most users do first), but other formats could include
Excel, Word, or PDF.
- AdditionalInfo -
This field is an XML datatype and contains a hodge podge of different
information including ScalabilityTime, which identifies reports which may
be under memory pressure, and EstimatedMemoryUsageKB, which records the
peak memory usage.
Now we can move onto making use of this information for actual reporting using Business Intelligence Design Studio or BIDS. First, create a new Reporting Services Project. We will utilized shared data sources, so right click on Shared Data Source, and Select Add New Data Source.USE
[ReportServer]
GO
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE VIEW
[dbo].[ExecutionLog3_Modified]
AS
SELECT
EL.InstanceName
,
COALESCE
(
C.Path
,
'Unknown'
)
AS
ItemPath
,
EL.UserName
,
EL.ExecutionId
,
CASE
(
EL.RequestType
)
WHEN
0
THEN
'Interactive'
WHEN
1
THEN
'Subscription'
WHEN
2
THEN
'Refresh Cache'
ELSE
'Unknown'
END AS
RequestType
,
-- SubscriptionId,
EL.Format
,
Parameters
,
CASE
(
EL.ReportAction
)
WHEN
1
THEN
'Render'
WHEN
2
THEN
'BookmarkNavigation'
WHEN
3
THEN
'DocumentMapNavigation'
WHEN
4
THEN
'DrillThrough'
WHEN
5
THEN
'FindString'
WHEN
6
THEN
'GetDocumentMap'
WHEN
7
THEN
'Toggle'
WHEN
8
THEN
'Sort'
WHEN
9
THEN
'Execute'
ELSE
'Unknown'
END AS
ItemAction
,
EL.TimeStart
,
YEAR
(
EL.TimeStart
)
AS
Start_Year
,
MONTH
(
EL.TimeStart
)
AS
Start_Month
,
DATENAME
(
MONTH
,
EL.TimeStart
)
AS
Start_Month_Name
,
DATENAME
(
DW
,
EL.TimeStart
)
AS
Start_Day_Of_Week
,
DATEPART
(
WEEKDAY
,
EL.TimeStart
)
AS
Start_Day_Number_of_Week
,
EL.TimeEnd
,
EL.TimeDataRetrieval
,
EL.TimeProcessing
,
EL.TimeRendering
,
CASE
(
EL.Source
)
WHEN
1
THEN
'Live'
WHEN
2
THEN
'Cache'
WHEN
3
THEN
'Snapshot'
WHEN
4
THEN
'History'
WHEN
5
THEN
'AdHoc'
WHEN
6
THEN
'Session'
WHEN
7
THEN
'Rdce'
ELSE
'Unknown'
END AS
Source
,
EL.Status
,
EL.ByteCount
,
EL.[RowCount]
,
EL.AdditionalInfo
,
C.Name
,
C.CreatedByID
,
C.ModifiedByID
,
C.Description
,
C.CreationDate
,
C.ModifiedDate
,
CASE
WHEN
C.
TYPE=
1
THEN
'Folder'
WHEN
C.
TYPE=
2
THEN
'Report'
WHEN
C.
TYPE=
3
THEN
'XML'
WHEN
C.
TYPE=
4
THEN
'Linked Report'
WHEN
C.
TYPE=
5
THEN
'Data Source'
WHEN
C.
TYPE=
6
THEN
'Model'
WHEN
C.
TYPE=
8
THEN
'Shared Dataset'
WHEN
C.
TYPE=
9
THEN
'Report Part'
END AS
Type_Description
FROM
ExecutionLogStorage
AS
EL
LEFT
OUTER
JOIN
Catalog
AS
C
ON
(
EL.ReportID
=
C.ItemID
)
GO
then OK again.
We will now create the dataset to be used in the report. This step requires planning and forethought as to what fields will be displayed on the report and what fields will be used to filter the data both when establishing the dataset and during report generation as parameters. These decisions will impact how the data is returned to the design grid and ultimately to the report itself. To create the data set, right click on Shared Datasets and then select Add New Dataset.
Finally, click Add.
No comments:
Post a Comment