How to re write the script for maximum effencieny

Plan2.pesession (2.2 MB)
avatar image By Marek 0 asked Apr 20 at 06:59 AM
more ▼
(comments are locked)
avatar image Aaron Bertrand ♦ Apr 26 at 04:33 PM

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).

10|10000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 50 attachments (including images) can be used with a maximum of 209.7 MB each and 209.7 MB total.

Follow this question



asked: Apr 20 at 06:59 AM

Seen: 160 times

Last Updated: Apr 26 at 04:33 PM