« Fixing Login Delays | Main | Firewire disks on linux! »
March 30, 2005
I learned something new today!
SQL Server 2000 trick:
DO NOT use " SELECT @@IDENTITY FROM myTable " to determine the ID of the last record inserted. It works, but it returns ALL of the values for identity.
Instead, " SELECT @@IDENTITY " works the way you'd expect -- it returns ONLY the ID of the last record inserted.
The really cool thing is that one of our DBAs at work found this while doing a routine performance scan of the production database... And by removing just those two words " FROM myTable " from the query, on the production table size, we'll go from 4-6 seconds per record in my dataset, to 1-2 seconds per.
That totally made my day. I'm still excited at having THE TEAM speed up my app. We put the test version into a user environment, and it's processing around 7500 records in an hour. We're quite happy about it.
I'm tempted to ask the DBA to monitor the load testing that's going on, explicitly, so we can make some more improvements...
Posted by aland at March 30, 2005 11:06 PM
Trackback Pings
TrackBack URL for this entry:
http://www.aland.us/mt/mt-tb.cgi/85