Search code examples
sql-serverperformancesql-server-cesql-server-profiler

SQL Profiler and Tuning Advisor for Reporting Services - what events should be selected?


I've used the SQL Profiler to generate a trace file, and tuning advisor to take that trace file and provide some recommendations on db updates.

However, the SQL Profiler doesn't seem to track the queries when running against a Reporting Server, the profiler doesn't seem to be capturing any of the queries. I'm logging the defaults (SQL:BatchCompleted and Starting, RPC:completed, and Sessions - Existing Connections)

What events should I be capturing in SQL Profiler in order to run the tuning advisor?

Update:

The BatchStarting even is capturing some SQL; however it's always something to do with the event or notifications table :

                                        declare @BatchID uniqueidentifier

                                        set @BatchID = NEWID()

                                        UPDATE [Event] WITH (TABLOCKX)
                                            SET [BatchID] = @BatchID,
                                            [ProcessStart] = GETUTCDATE(),
                                            [ProcessHeartbeat] = GETUTCDATE()
                                        FROM (
                                            SELECT TOP 8 [EventID] FROM [Event] WITH (TABLOCKX) WHERE [ProcessStart] is NULL ORDER BY [TimeEntered]
                                            ) AS t1
                                        WHERE [Event].[EventID] = t1.[EventID]

                                        select top 8
                                            E.[EventID],
                                            E.[EventType],
                                            E.[EventData]
                                        from
                                            [Event] E WITH (TABLOCKX)
                                        where
                                            [BatchID] = @BatchID
                                        ORDER BY [TimeEntered]

Solution

  • Here's what was happening, and how to work around it.

    It appears that Reporting Server caches data in a temp database. Since most of our reports all used a common view, all of that data was being retrieved from cache.

    After selected "Show All Events", under "Stored Procedures" I selected CacheHit, CacheInert, CacheMiss, Completed, StmtCompleted, and StmtStarting.

    There was then enough information in the trace file for the profiler to evaluate and make recommendations.