MySQL query takes too long:
SELECT winlogs.image, winlogs.winitem, winlogs.grade, winlogs.caseid, winlogs.status, winlogs.price, winlogs.id, lockeditems.tradeid, cases.image AS caseimg, cases.grade AS casegrade, items.preview FROM winlogs LEFT JOIN lockeditems ON lockeditems.asset = winlogs.asset LEFT JOIN cases ON winlogs.caseid = cases.caseid LEFT JOIN b_items ON b_items.asset = winlogs.asset WHERE winlogs.userid = '616632589' ORDER BY winlogs.time DESC LIMIT 1, 25; In the tables: winlogs: 5500 rows 10 columns, there is text lockeditems: 2 rows 7 cases column: 50 rows 15 columns b_items: 1000 rows 12 columns, there is text userid = # user.
Initially, the query worked quickly, when the user in winlogs had only 100-150 lines for example. Now this user 616632589 has about 1300 lines of victories (in the winlogs table), so the request itself is triggered 3 seconds (measured via show profiles), when you open its profile, terrible brakes. Not to mention what will happen when the user has 10,000+ wins.
What can be thought up to speed up the execution of the request? Tables touch / combine will not work.
EXPLAIN(EXPLAIN SELECT...) command and add the result, perhaps, this will make the situation clearer. - Ksenia