February 6, 2014 at 5:32 am
Dear All,
For my project salary calculation writtened in Stored Proceure based.There is nearly 50 stored Procedure to Calculate different kind of Calculations.Some of the Stored Proceure Temprory tables used to do intermediate calculation and finally pushed to maintable.
Is more usage of Temprory table degrade the performance.For the every used Temprory tables proper indexing done.We noticed that Temprory Database some pressure is there while executing the process.Can i convert the Temprory table to Static intermediate table.Kindly give your views.
Regards
Siva
February 6, 2014 at 6:01 am
You may create constraints and indexes on temporary tables. I think you would benefit by having a regular table; that way you could depend on constraints and indexes and possibly updated statistics always being there. There are global and local temp tables depending on a declaration like #tbl or ##tbl and the local ones are cleaned up when a connection is closed. I find that there is overhead in using global objects accessible outside of a connection. Temp tables cause contention in sysobjects which might be a problem if you are often creating and dropping them.
Table variables within a stored procedure perform very well if there are less than thousands of rows and they benefit from constraints.
You may need to play around with your unique situation to find out empirically what works best.
February 6, 2014 at 6:41 am
Any additonal line of code (excluding comments) degrades the performance less or more...
There is nothing wrong with using temp tables.
Using static (permanent) tables, global temp tables and/or table variables will not avoide using tempdb, which whould be properly managed by DBA's (yes queries using just and only permanent tables also might use tempdb).
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply