sql server - Different performance for simple update query -
i have database restored on 2 different machines (developer machine, , tester machine), , whilst not identical have similar performance.
using next query (obfuscated):
create table #tmptable (mapid int, primary key(mapid)) update maptable set tstamp = getdate() maptable bring together territory territory on territory.id = maptable.territoryid left bring together #tmptable on #tmptable.mapid = maptable.mapid maptable.tstamp > dateadd(year, -100, getdate()) , territory.name not null , territory.name not '!%' , #tmptable.mapid null for 400k records, developer machine updates in 4 seconds, on tester machine updates in 25 seconds; same db restored on both machines.
the problem when running through tool use, timeout queries set 30 seconds , timeouts 90+ % of time on tester machine.
but execution plan on both same...
can suggest why is, , possible optimisation(s)?
one thing can see 'might' have impact on performance utilize of getdate() function might called twice each record, once, that's 400k calls function!
i set result of getdate() variable , utilize that, unless there reason no to, illustration changes in date throughout query required in batch processing within cursor.
however, uncertainty main issue performance. such big difference in execution time between different machines execution plan same looking @ factors external sql such cpu usage, hdd usage, speed , fragmentation etc.
sql-server tsql
No comments:
Post a Comment