Query Performance

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Ramnadh (Ramnadh_at_discussions.microsoft.com)
Date: 11/15/04


Date: Mon, 15 Nov 2004 01:49:13 -0800

Hi,

This is my query execution plan which i got when executing the query and the
statistics while executing the query

       |--Compute Scalar(DEFINE:([Expr1006]=If ([MSGS].[SenderId]=-1) then
'Publisher' else ([Resource].[FirstName]+' '+[Resource].[LastName])))
            |--Sort(ORDER BY:([MSGS].[SentOn] DESC))
                 |--Merge Join(Right Outer Join,
MERGE:([T].[Id])=([MSGS].[PriorityTypeId]),
RESIDUAL:([MSGS].[PriorityTypeId]=[T].[Id]))
                      |--Clustered Index
Scan(OBJECT:([Viper_Onsite].[dbo].[Type].[PK_Type] AS [T]), ORDERED FORWARD)
                      |--Sort(ORDER BY:([MSGS].[PriorityTypeId] ASC))
                           |--Merge Join(Right Outer Join,
MERGE:([Resource].[Id])=([MSGS].[SenderId]),
RESIDUAL:([MSGS].[SenderId]=[Resource].[Id]))
                                |--Clustered Index
Scan(OBJECT:([Viper_Onsite].[dbo].[Resource].[PK_Resource]), ORDERED FORWARD)
                                |--Sort(ORDER BY:([MSGS].[SenderId] ASC))
                                     |--Hash Match(Inner Join,
HASH:([TP].[Id])=([MSGS].[TypeId]))
                                          |--Clustered Index
Scan(OBJECT:([Viper_Onsite].[dbo].[Type].[PK_Type] AS [TP]))
                                          |--Merge Join(Inner Join,
MERGE:([MSGS].[Id])=([MSGR].[MessageId]),
RESIDUAL:([MSGR].[MessageId]=[MSGS].[Id]))
                                               |--Clustered Index
Scan(OBJECT:([Viper_Onsite].[dbo].[Message].[PK_Message] AS [MSGS]), ORDERED
FORWARD)
                                               |--Clustered Index
Scan(OBJECT:([Viper_Onsite].[dbo].[MessageRecipient].[IX_MessageRecipient_MessageId]
AS [MSGR]), WHERE:(([MSGR].[RecipientId]=[@recipientId] AND
[MSGR].[MessageState]<>'PD') AND [MSGR].[Mes

Statitstics:

SQL Server Execution Times:
   CPU time = 0 ms, elapsed time = 0 ms.

SQL Server Execution Times:
   CPU time = 0 ms, elapsed time = 0 ms.
SQL Server parse and compile time:
   CPU time = 0 ms, elapsed time = 0 ms.
SQL Server parse and compile time:
   CPU time = 0 ms, elapsed time = 0 ms.

SQL Server Execution Times:
   CPU time = 0 ms, elapsed time = 0 ms.

Table 'MessageRecipient'. Scan count 1, logical reads 577, physical reads 0,
read-ahead reads 536.
Table 'Message'. Scan count 1, logical reads 3792, physical reads 0,
read-ahead reads 3576.
Table 'Type'. Scan count 2, logical reads 8, physical reads 0, read-ahead
reads 0.
Table 'Resource'. Scan count 1, logical reads 39, physical reads 0,
read-ahead reads 40.

SQL Server Execution Times:
   CPU time = 451 ms, elapsed time = 5673 ms.
Table 'MessageRecipient'. Scan count 1, logical reads 6010, physical reads
0, read-ahead reads 5.

SQL Server Execution Times:
   CPU time = 60 ms, elapsed time = 104 ms.

SQL Server Execution Times:
   CPU time = 60 ms, elapsed time = 105 ms.
SQL Server parse and compile time:
   CPU time = 0 ms, elapsed time = 0 ms.

I doesn't understand exactly what are the logical reads. Can anyone explain
what the logical reads are ?
and also it is showing that elapsed time is more than 5000 ms. What is the
elapsed time ?
As i am new to sql server.. i doesn't understand the execution plan properly.
Can anyone help me out....



Relevant Pages

  • Re: Query Performance
    ... needed to process the query. ... > SQL Server Execution Times: ...
    (microsoft.public.sqlserver.programming)
  • Query tuning issues.. not using the right indexes and hence very slow in running
    ... Please help me in turning the query. ... ISVCO_UPPER_COMPANY_NAME nvarchar NULL, ... SQL Server Execution Times: ...
    (microsoft.public.sqlserver.programming)
  • Re: Query Performance
    ... you will find more articles on sql-server-performance related to query ... > SQL Server Execution Times: ...
    (microsoft.public.sqlserver.programming)
  • RE: why do char columns slow down query?
    ... covered index on you query. ... > select RTEID, RTEDateTime ... > SQL Server Execution Times: ...
    (microsoft.public.sqlserver.programming)
  • Re: Tuning query?
    ... SQL Server Execution Times: ... ie lots of logical reads but 0 physical reads and query completes instantly ... > regular columns, not computed? ...
    (microsoft.public.sqlserver.programming)