Groups | Blog | Home
all groups > sql server mseq > april 2005 >

sql server mseq : Query Performance



MoinJ
4/20/2005 12:14:02 PM
I have 2 tables, Make and Model where Make is the master table and Model has
a reference of make table by Make_Id since there can be multiple models for a
single make. Now, i have 4 SQL's below and i want to know which SQL should
perform better.

select make.make_name, model.model_name
from make, model
where make.make_id = 1000
and make.make_id = model.make_id


select make.make_name, model.model_name
from make, model
where make.make_id = 1000
and model.make_id = make.make_id


select make.make_name, model.model_name
from make, model
where make.make_id = model.make_id
and make.make_id = 1000


select make.make_name, model.model_name
from make, model
where model.make_id = make.make_id
and make.make_id = 1000

Thanks,
Moin



Hugo Kornelis
4/20/2005 11:12:38 PM
[quoted text, click to view]

Hi Moin,

The usual answer to "which of these queries performas better" is to test
them all, in _your_ database, on _your_ tables with _your_ data and on
_your_ hardware. However, in this case it's safe to say that you won't
see any difference. The query optimizer is free to reshuffle the
expressions in the where clause (as long as it won't effect the end
result), so you can expect all four queries to result in the exact same
execution plan.

Best, Hugo
--

AddThis Social Bookmark Button