SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Query Optimization


Query Optimization

Author
Message
Mishal
Mishal
SSC Journeyman
SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)

Group: General Forum Members
Points: 77 Visits: 168
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.
Attachments
PKINDEX.jpeg (9 views, 95.00 KB)
INCLUDEINDEX.jpeg (8 views, 76.00 KB)
LutzM
LutzM
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10825 Visits: 13559
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
Mishal
Mishal
SSC Journeyman
SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)

Group: General Forum Members
Points: 77 Visits: 168
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search