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
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
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
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
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
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)