Question : SELECTs from a temporary table and NOLOCKs

To speed up my stored procs, I use

SELECT * FROM table WITH (NOLOCK)

I've noticed that this saves a tremendous amount of time.

Does anyone know if there's any speedup at all by using NOLOCKs on temporary tables, created in the same SP? As in:

CREATE TABLE #temptable (tempitem int)
SELECT * FROM #temp WITH (NOLOCK)

The reason for asking is that I have *alot* of SP's, using *alot* of temporary tables, and if someone could give me a quick answer, I'd appreciate it.

Answer : SELECTs from a temporary table and NOLOCKs

My opinion (based on what I reda) is that you obtain a speed boost(not a big one if the SP is a small one), because this way the SQL Server uses no locks!!!

The same thing you can obtain by simply issuing a
set transaction isolation level read uncommitted
at the begining of each SP you have......

but be carefull maybe in certain situation you need to use the locking mechanims, and by using NOLOCK you may introduce inconsistent data....

good luck,
  xenon
Random Solutions  
 
programming4us programming4us