How many rows in INVOICE_LINE_ITEMS in total? That seek of ~5 million rows seems like an incorrect choice. Tough to tell things from an estimated plan, though. Do you get the same plan for different parameters (like a single day, or an entire year)? It may be worth using OPTION (RECOMPILE) to prevent caching a plan optimized for small date ranges and using it for large date ranges (or vice versa).
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 x671
plan explorer upload x481
asked: Apr 20, 2017 at 06:59 AM
Seen: 187 times
Last Updated: Apr 26, 2017 at 04:33 PM
Help Optimizing View
Estimated way too less compared to Actual no of rows
multi view query
Why nested loop instead of more efficient merge join?
query is very slow
Speeding up sorting subtree
Index Seek but high cost
Sudden slowdown of inline code on 2014, fast with old CE, but can't change.
This query is very slow. I am new to spatial indexes and am not sure where to begin tuning this query.
© 2013 SQL Sentry, Inc. All rights reserved.