mysql optimization gender optimization
怪我咯
怪我咯 2017-05-18 10:51:08
0
3
720

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

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
巴扎黑

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)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!