i have a table that I select by the main id, and then sort say ... by the sequence number
Cust_ID Seq_No
------- ------
1111 1
1111 2
2222 1
3333 1
3333 2
3333 3
etc.. etc ...
i usually use a query like
select * from Customers where Cust_ID=3333 order by Seq_No
.... and when I link to other tables .. I link by the Cust_ID only.
Can I use only one composite index which can handle both the SELECT and SORT quickly like ...
CREATE INDEX IX_CustID ON Customers(Cust_ID, Seq_No)
or do I need to have 2 separate indexs
CREATE INDEX IX_CustID ON Customers(Cust_ID)
CREATE INDEX IX_CustID ON Customers(Cust_ID, Seq_No)
Cust_ID Seq_No
------- ------
1111 1
1111 2
2222 1
3333 1
3333 2
3333 3
etc.. etc ...
i usually use a query like
select * from Customers where Cust_ID=3333 order by Seq_No
.... and when I link to other tables .. I link by the Cust_ID only.
Can I use only one composite index which can handle both the SELECT and SORT quickly like ...
CREATE INDEX IX_CustID ON Customers(Cust_ID, Seq_No)
or do I need to have 2 separate indexs
CREATE INDEX IX_CustID ON Customers(Cust_ID)
CREATE INDEX IX_CustID ON Customers(Cust_ID, Seq_No)