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  | 
                             
                            
                                    | 
                                         rgombina 
                                        Constraint Violating Yak Guru 
                                         
                                        
                                        319 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-12-18 : 06:19:04
                                            
  | 
                                             
                                            
                                            | Hi there,The performance of my SQL tasks is significantly degrading after certain record output block. I have multi-statement steps to pivot rows and dump data to a stage table using TABLE variables. Is there a way to release/dispose TABLE variable's data and perhaps the cause of performance issue?The same multi-statements of 10,000 rows output takes 3 miutes versus 20 minutes on 25,000 rows output.Thanks. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     SwePeso 
                                    Patron Saint of Lost Yaks 
                                     
                                    
                                    30421 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-18 : 06:51:41
                                          
  | 
                                         
                                        
                                          If the totalt data exceeds two pages, I have found that table variables are slow, much slower than temp tables. E 12°55'05.63"N 56°04'39.26"  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     rgombina 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    319 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-18 : 07:04:29
                                          
  | 
                                         
                                        
                                          | Yes definitely more than two pages and also tried temp table, which is faster. I'm going to divide it and see if helps perfornamce. Thanks.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     robvolk 
                                    Most Valuable Yak 
                                     
                                    
                                    15732 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-12-18 : 07:17:47
                                          
  | 
                                         
                                        
                                          | Keep in mind that indexing can be a tremendous help to performance, and temp tables can be indexed like any other table.  Take a close look at your query plans and test some index options.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |