Quick observation: you have to scan all 3 million rows of the clustered index because you don't have a narrower index on LG_001_07_STINVTOT to satisfy the correlated subquery. How about an index on (date,stockref,onhand,actsorder) WHERE invenno < 4, and changing SUM(onhand)-SUM(ACTSORDER) to SUM(onhand-ACTSORDER), and changing the WHERE IN to match the where clause of the filtered index?
Up to 50 attachments (including images) can be used with a maximum of 209.7 MB each and 209.7 MB total.
Answers and Comments
query plan x691
plan explorer upload x502
clustered index x25
asked: Sep 11, 2014 at 06:43 AM
Seen: 205 times
Last Updated: Sep 11, 2014 at 06:43 PM
How can I get an Index Seek on this PK CLUSTERED index?
Tbl_Hurdle_Test Only has 25 000 rows why in the actual plan does the Table contain over 400 mil rows
what indexes to apply/drop
Function call as INNER JOIN causes slow RID lookup
Statistics On Temporary Tables
Slow Query - Incorrect Estimated Executions?
The query takes a long time to run, looking for options to try and get it to run faster based on this plan?
Query plan shows index seek on table not referenced in the query anywhere
SQL Server execution plan is using PK instead of index
How to decrease the cost for Index Seek Operation
© 2013 SQL Sentry, Inc. All rights reserved.