on 2014 May 16 9:02 AM
When 2 tables are joined, with a relation 1:100 like:
Table A: Col1, Col2, Col3
Table B: Col1, Col2, Col4, Col5
Executing a statement like:
Select Col1,Col2,Col4,Col5 from A key join B where Col3=x
When thinking of performance which one is better, selecting Col1 and Col2 from table A or from table B or is it equal?
Request clarification before answering.
I always prefer to choose cols from central table (in your case it's table A). But it's not because of performance, but because of factor that any sql in future can be modified. In the case of key join may be there are no difference, but if in future you must switch from key join for example to outer joins, so it's be much easy to made modifications to sql query. And I am always prefer to use table aliases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
29 | |
9 | |
8 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.