As you can see in the image query takes 1.28 minute to execute successfully. And as you can see in the figure , cause for the problem is Clustered Index Scan on LotDetails Table.
See the image below to get the clear idea about Clustered Index Scan Cost in this query.
What I did was Created Non-clustered index on “SlipID” and added “Active” column into Included Columns.
After doing this when I run my query it took 0 second to execute successfully. And Clustered index scan is now turned into Index seek which is 3% of the total execution cost.
So use index as and when required to boost the performance of your T-SQL Query.
Please correct me if I am wrong anywhere. :)
No comments:
Post a Comment