For example the order table
Order_id order id
Order_sn order no.
User_id user ID
Supplier_id merchant ID
Order_status order status
Pay_status pay state
Ship_status delivery status
Temporary lists the main fields
Create indexes problem:
1, the user can see the order list, according to user's ID_ order status pay _ _ the delivery state to create a composite index
2, the merchants can see the order list according to the businessman ID_ order status pay _ _ the delivery state to create a composite index
If there are other case, if they were going to continue to create various composite index (for example: the company background about statistical check all order list, etc.)?
The great god, please give directions, thank you
CodePudding user response:
Index is established on the basis of the use of,Which field the query will be used, at least use frequency, to build the index, if it is a composite index, using high frequency field on the front,
Using the same frequency fields, difference big field, on the front,
CodePudding user response:
As the upstairs said, don't indexed for indexed, if the data is not very big (more than 500000), does not need to be indexed, today's disk read/write speed is not slow,The original poster can refer to the following article
https://www.cnblogs.com/Aiapple/p/5693239.html
CodePudding user response: