SQL Server Index Question

I have a query that joins 3 tables in SQL Server 2005 but does not have a Where clause, so I index the fields found in the join statement.

If my index is set to Col1, col2, col3

And my connection

Tbl1
inner join tbl2
On
Tbl1.col3=tbl2.col3
Tbl1.col2=Tbl2.col2
Tbl1.col1=Tbl2.col1

Does the order of the join operator match the index order? Should I set my index as Col3, col2, col1? Or hack my expression about joining like Col1, col2, col3?

thanks

+3
source share
3 answers

For query purposes this does not matter. You can consider alternative ordinal sequences based on the following:

  • ( ORDER BY.. )
  • ( , / )

: , , , , , .. , OP , .

+1

SQL Server . , .

, , .

. JOIN , "" . (JOIN, WHERE), / . , .

+5

Col1-3, , " "

, "Status Ok" / "Status denied" 3, SSN Phonenumber

+1

Source: https://habr.com/ru/post/1717950/


All Articles