Peter Larsson Blog

Patron Saint of Lost Yaks

Finding group of records with a certain status II

I got some response from same topic posted on September 20
http://weblogs.sqlteam.com/peterl/archive/2007/09/24/Finding-group-of-records-with-a-certain-status.aspx
Hugo Kornelis posted an alternative code to my improvement and I promised to test it.

Here is the new results (made on other machines so the absolute numbers do not match).
SQL 2000  Memory CPU DURATION READS WRITES
Original    5304 670      920 13555      0
Peso        8685 125      125   604      0
Hugo        8685 110      110   604      0

SQL 2005 Memory CPU DURATION READS WRITES

Original 8838 437 558 851 0

Peso 8838 172 250 562 0

Hugo 8838 125 230 562 0

As Hugo suspected, the NOT EXISTS (double negation) is slightly faster.