Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query Optimization Expand / Collapse
Author
Message
Posted Wednesday, October 12, 2011 12:24 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, June 4, 2013 11:39 PM
Points: 50, Visits: 149
Hi,

I am working with sql server 2000 and 2005,could any one suggest me how to
optimize a select query which is also using aggregate function on some of its columns.
I have tried the following alternatives,

1. I have used index on the table which is using the column order same as in where clause.but in this case RID/KEY lookup is taking primary key index and consuming most of the cost of the QUERY EXECTION.

Execution Plan Of this case is Shown in Image-1
2. To avoid RID/KEY lookup,I have used INCLUDE Index,So that all the non primary keys are also included in index.In this case Sort Operator is consuming too much time and again i am at the same place,no improvement in reducing Execution time of Query.
Execution Plan for this case is shown in image-2 below where sort opertator is taking 70% of CPU Cost.

Please help me out of this issue.



  Post Attachments 
PKINDEX.jpeg (3 views, 95.43 KB)
INCLUDEINDEX.jpeg (1 view, 76.26 KB)
Post #1189375
Posted Wednesday, October 12, 2011 12:59 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 10:18 AM
Points: 7,125, Visits: 13,173
Please attach the actual execution plan (not the estimated) as sqlplan files. Jpegs won't help much here...

Also, please post table and index definition of all tables involved and the actual query (since it might not be shown completely in the sqlplan).

As a side note: I don't think this question has anything to do with Notification Services. Why did you use this forum then to post your question? But there's no reason to re-post it. Just make sure to pick the correct forum with your next question (assuming there'll be one...)




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1189394
Posted Thursday, October 13, 2011 3:57 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, June 4, 2013 11:39 PM
Points: 50, Visits: 149
thx LutzM

Now i have post my problem on this link
http://www.sqlservercentral.com/Forums/Topic1189699-360-1.aspx
could u plz suggest me,solution to my problem.
Post #1189704
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse