How can I speed up MySQL query with multiple joins

前端 未结 7 1463
再見小時候
再見小時候 2021-02-07 11:25

Here is my issue, I am selecting and doing multiple joins to get the correct items...it pulls in a fair amount of rows, above 100,000. This query takes more than 5mins when the

7条回答
  •  死守一世寂寞
    2021-02-07 12:05

    As everyone says, make sure you have indexes.

    You can also check if your server is set up properly so it can contain more of, of maybe the entire, dataset in memory.

    Without an EXPLAIN, there's not much to work by. Also keep in mind that MySQL will look at your JOIN, and iterate through all possible solutions before executing the query, which can take time. Once you have the optimal JOIN order from the EXPLAIN, you could try and force this order in your query, eliminating this step from the optimizer.

提交回复
热议问题