Re: Which inner join syntax is more efficent?
From: Ian King (idking_at_telkomsa.net)
Date: 09/12/04
- Next message: Nigel Rivett: "RE: Copy row in trigger instead of update?"
- Previous message: Dave O.: "How should client install SQLXML for SQLXMLBulkLoad use?"
- In reply to: olduncleamos_at_yahoo.com: "Which inner join syntax is more efficent?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 12 Sep 2004 21:19:31 +0200
Hi,
[1] You may want to look at Quest - SQL Tuning for SQL Server :
http://www.quest.com/quest_central/sql_server/sql_tuning/
(I think there is a trial version)
It evaluates your SQL, generates multiple semantically equivelant
statements, executes all of them, and selects the most efficient.
[2] Also, use the SET STATISTICS IO ON, when you compare your queries.
This will give you CPU & Page read stats.
[3] In general, I've observed that specifying the expression in the
WHERE clause performs better than in the ON clause. (Although I havent
done it enough times to reach any conclusions...)
thanks
Ian
olduncleamos@yahoo.com wrote:
> Hello all.
>
> Assuming both TableA and TableB are roughly the same size with index
> on COL_1 on both table. Which syntax will be more efficient?
>
> SELECT A.Col_1, B.Col_2 FROM
> TableA AS A INNER JOIN TableB AS B ON A.Col_1 = B.Col_1
> WHERE A.Col_1 = @Some_Value
>
> OR
>
> SELECT A.Col_1, B.Col_2 FROM
> TableA AS A INNER JOIN TableB AS B ON A.Col_1 = B.Col_1 AND A.Col_1 =
> @Some_Value
>
> Any help will be greatly appreciated.
- Next message: Nigel Rivett: "RE: Copy row in trigger instead of update?"
- Previous message: Dave O.: "How should client install SQLXML for SQLXMLBulkLoad use?"
- In reply to: olduncleamos_at_yahoo.com: "Which inner join syntax is more efficent?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|