![]() Unless they are explicitly dropped, global temporary tables, andlocal temporary tables created within a connection rather than within a stored procedure, will persist until the connection is closed or, withconnection pooling, until the connection is reused. The problem with temp tables is that, because they are scoped either in the procedure or the connection, it is easy to allow them to hang around fortoo long, eating up precious memory and bulking up the shared tempdb database. In other words, a fairly major feature of SQLServer should be more-or-less 'off limits' to developers. Not everyone shares his opinion in fact, I imagine hewas rather aghast to learn that there were those felt his article was akin to pulling the pin out of a grenade and tossing it into the database tablevariables should be avoided in almost all cases, according to their advice, in favour of temp tables. Phil makes clear that the table variables do come with some fairly majorlimitations.no distribution statistics, no parallel query plans for queries that modify table variables.but goes on to suggest that for reasonably small-scale strategic uses, and with a bit of due care and testing, table variables are a "good thing". Last month, Phil Factor caused a furore amongst some MVPs with an article that attempted to offer simple advice to developers regarding the useof table variables, versus local and global temporary tables, in their code. A temporary disagreementPublished Friday, Octo10:54 AM
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |