Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         ranvir_2k 
                                        Posting Yak  Master 
                                         
                                        
                                        180 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2013-10-15 : 07:05:27
                                            
  | 
                                             
                                            
                                            | Hi all,I have a stored procedure that was taking 4 hours to run. So I used the tuning advisor for some index and stats recommendations. It estimated that the performance improvement would be 90%.These indexes and stats improved performance drastically, the stored proc only took 7 mins to run.However it has since gone back to taking 4 hours to run.If I use the tuning advisor it does not recommend any new indexes on top of the ones I have already used.So what could be the problem?Thanks | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     tkizer 
                                    Almighty SQL Goddess 
                                     
                                    
                                    38200 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-10-15 : 08:13:34
                                          
  | 
                                         
                                        
                                          | It's likely a bad plan or out of date statistics. Check the execution plan to see if it's using the new index(es). Try updating stats, or you could try recompiling it if it got a bad plan. And if this continues to happen, you could add the WITH RECOMPILE option to the stored procedure, provided it's not run very often (like thousands of times per minute) unless you have the CPU overhead.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     jackv 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    2179 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2013-10-16 : 01:44:42
                                          
  | 
                                         
                                        
                                          | One consideration , when adding indexes , is the impact it will have on INSERTS , DELETES and index maintenance.Jack Vamvas--------------------http://www.sqlserver-dba.com  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |