|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 2:37 PM
Points: 214,
Visits: 166
|
|
Hi Randy,
Thanks for the article. We also had similar issues joining two three tables with over 200 Million rows with WHERE condition, the O/P was dying if we used derived tables or JOINS. But once we started using #temp tables pre-populated with where conditions the queries executed in seconds.
I think execution manager in SQL Server 2005 in not efficiently managing the worker tables or derived tables when the dataset is huge.
Regards,
Razi, M. http://questivity.com/it-training.html
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Yesterday @ 2:54 PM
Points: 31,410,
Visits: 13,726
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, May 24, 2010 2:28 AM
Points: 18,
Visits: 102
|
|
> I am not fond of cursors and advocate doing anything possible to replace the cursor
What do you gain by handling the looping yourself rather than just using a cursor? I try and get rid of cursors by replacing with a single sql statement. Obviously this won't work if you have to call a stored procedure for every record in a table (for example), but if you have to do this then why is using your own looping mechanism preferable to using a cursor?
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Yesterday @ 5:33 PM
Points: 32,902,
Visits: 26,783
|
|
alex (5/15/2009) > I am not fond of cursors and advocate doing anything possible to replace the cursor
What do you gain by handling the looping yourself rather than just using a cursor? I try and get rid of cursors by replacing with a single sql statement. Obviously this won't work if you have to call a stored procedure for every record in a table (for example), but if you have to do this then why is using your own looping mechanism preferable to using a cursor?
I agree... a good "firehose" cursor makes sense here.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|