compare performance between two query
-
-
-
The first thing isn't a query. And they are unequal, as Tim mentioned. And have you considered:
SELECT @b = LEFT(CASE @aa WHEN 1 THEN @a ELSE @c END ,10)
I expect they are all very similar in performance, but I would stick with pure SQL. -
-
-
ok thank you for reply. but how can i do this ,i mean use of sql profiler for compare performance between two query? thank you
mehdi.sabet wrote:
but how can i do this ,i mean use of sql profiler for compare performance between two query?
It's usually not very helpful to try and find "small" differences like those; there's also some intelligence in the server, and something called an optimizer. If your queries are slow, find out which ones are the mayor culprits. You can simply time them, by whichever means you want. Then, optimize those. Also periodically check your server for the usual stuff that a DBA would check; are your indexes still good? Does the Wizard from the management studio agree with that? (I believe there's an index-wizard in Sql2008+) Do the procedures fetch unnecessary data (think "select *" when "select cola, bolb" would do), do any of the tables need partitioning? How about caching stuff?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
mehdi.sabet wrote:
but how can i do this ,i mean use of sql profiler for compare performance between two query?
It's usually not very helpful to try and find "small" differences like those; there's also some intelligence in the server, and something called an optimizer. If your queries are slow, find out which ones are the mayor culprits. You can simply time them, by whichever means you want. Then, optimize those. Also periodically check your server for the usual stuff that a DBA would check; are your indexes still good? Does the Wizard from the management studio agree with that? (I believe there's an index-wizard in Sql2008+) Do the procedures fetch unnecessary data (think "select *" when "select cola, bolb" would do), do any of the tables need partitioning? How about caching stuff?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]