The relationship between join sequence and index setting
I heard that setting index开发者_运维技巧 is closely related to the sequence of joining tables. Could you provide some examples or article about this point?
Thanks.
Not so much the join sequence as written by you, but the join sequence that the Query Optimizer elects to use.
So... if you're joining on two fields called CustomerId, then indexing that field in both tables (using an index which also incorporates fields that are needed by the query), then you can get a Merge Join happening.
Bear in mind that if your query filters a table using somefield = somevalue, then your filter should be on somefield first.
精彩评论