有一张表,大概 180w 条数据,有一条 sql,如下 ``` select * from order where 1 = 1 and user_id = 12345 and mchcode = '56789' and (0 or order_state = 2 or order_state = 4 or order_state = 5 ) and (order_property_bit & 128)=128 and channel_type = 2 order by create_time desc LIMIT 1 OFFSET 0; ``` 查询花了 5s,我 explain 了下这条 sql,大概是这样的
-------+---------------+-------------+---------+------+------+----------+-------------+ | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +-------+-------+-------+-------------+---------+------+------+----------+-------------+ | index | mchcode | create_time | 5 | NULL | 1311 | 0.00 | Using where | +-------------+-------------------------+------------+-------+---------------+----------