Hi, We are runnig one query which takes one jour to finish. How can i make it faster? I have attached the execution plan below. Any idea?
Your stats seem way out. Do you do any maintenance around them ? nolock hints are generally not a good idea. Any reason why you are using them (they dont make queries go faster). For a small improvement you can tweak your indexes to remove the key lookups.
Multiple DISTINCTs are definitely a warning sign for me, as is the hash match which results from a self-join. What are the actual requirements for this query? I also agree with Matak about the key lookups (it should be easy to add the missing columns to those indexes to eliminate those) and stats (SQL Server seems to have absolutely no clue how many rows might be in the Trend table).
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
asked: Dec 04, 2016 at 04:20 AM
Seen: 443 times
Last Updated: Jan 08, 2017 at 05:09 PM
How to get rid of Hash Join and Sort
Is there anyway to improve query
Improve query performance
How can I make this perform better?
Extrem slow INSERT without reason
Fast query runs really poorly on VM Server
How to optimize this query
Clustered index scan causing the stored procedure to run slow
This query is taking over 2 minutes to run. Please help
Complex Execution Plan
© 2013 SQL Sentry, Inc. All rights reserved.