Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
avijit_mca
Posting Yak Master
109 Posts |
Posted - 2010-02-26 : 01:23:43
|
| Hi,How the table order should be there for best query performance.Any idea?Suppose tabel A is master table.i need to join 4 another table say b,c,d,e.A table having relationship with others table b,c,d,e with fk.so first should come table A for joining. but after that how i will make sequence table order for best reult.Regards,AvijitRegards,avijit |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-02-26 : 02:11:36
|
| Well it depends on the indexes you have added for the tables.Since A is master table then I assume the records in A will be much less than other tables.If table A has a clustered index on the column that joins the table B and there is one-to-many relationship between A and B, then Merge join will be used, and SQL Server will scan n1 + n2 rather than n1*n2 which will result in nested loop join which is some kind of a cartesian product and is the worst case scenario.PBUH |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-26 : 03:43:28
|
| The optimiser will, usually, make the same query plan whatever order you put your tables in. |
 |
|
|
avijit_mca
Posting Yak Master
109 Posts |
Posted - 2010-02-26 : 06:03:06
|
| Hi Kristen,there is no matter table sequence in optimization query.Regards,avijit |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-26 : 08:33:28
|
quote: Originally posted by avijit_mca Hi Kristen,there is no matter table sequence in optimization query.Regards,avijit
Nope. Only the relationship between tables is a factor which determines what order you need to give them------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|