There are hundreds of thousands of users in the database, 90% of whom are men, sex = 1
For example: select uid member where sex =1 and xxx xx
Then this sex will scan the entire table, how to deal with it
巴扎黑2017-05-18 10:53:08
In this case, the discrimination of indexing on sex is too low, and it is of little use. Let’s consider creating indexes on other fields, such as the xxx below
ringa_lee2017-05-18 10:53:08
Creating a single-column index on sex can avoid full table scanning. If the efficiency is not high, you can consider establishing a joint index starting with sex and adding subsequent fields
阿神2017-05-18 10:53:08
Put sex in the first place in the multi-column index and process it programmatically. For example, when all of them are sex in (1, 2)