Home > database > Mysql index, query or particularly slow
Mysql index, query or particularly slow
Time:09-15
One of my order in the table has a multi-column index 1. Under normal circumstances, select the where colleagues behind with the index of the two fields, query quickly 2. But if I only query user_id this field will be particularly pretty, if combined with other judgment, basic card dead, in my impression, multi-column index, if can only use the first field is effective, the explain also shows effective
Want to know the cause of the slow query, hope to get your help, thank you
CodePudding user response:
1: in theory, if the column UserID high selectivity and equal distribution of data and use the index should be very fast 2: look from the execution plan, there are indexes, but Rows=300000 + explain the amount of data that is at least df_order table. Tens of millions of dollars not optimized, the best partition table. In addition, if the query conditions and other fields, can lead to back to the table, and an order of magnitude is slow