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  | 
                             
                            
                                    | 
                                         vanbasten 
                                        Starting Member 
                                         
                                        
                                        7 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2011-12-08 : 19:05:51
                                            
  | 
                                             
                                            
                                            | I have a stored procedure which runs a query on a view and return result.  The stored procedure was taking over 10 seconds to run so I did some optimization on the view.  After optimization, running the query on the view would return result instantaneously.  However, executing from the procedure which run the exact query (on top on the same view) still takes over 10 seconds.  I read something about plan caching and tried recompiling the procedure but it did not help.  Any idea?  Thanks in advance. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     tkizer 
                                    Almighty SQL Goddess 
                                     
                                    
                                    38200 Posts  | 
                                    
                                      
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     visakh16 
                                    Very Important crosS Applying yaK Herder 
                                     
                                    
                                    52326 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-12-09 : 00:18:43
                                          
  | 
                                         
                                        
                                          | something to do with parameter sniffing?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |