Umherirrender added a comment.
The table has `PRIMARY KEY (cl_from,cl_to)` So it could use a range index on the primary? Order is on primary `ORDER BY cl_from ASC,cl_to ASC` to make the query ready for unique paginate. But for the long list of cl_from it needs a filesort to find the subcats from it, which not so much rows in compare to the pages As this is a maintenance script and the run duration is not a big problem the filter to subcats may needs to move to the code instead. That can result in select of millions of rows and non is needed. Or trust cat_subcats and only select cl_from where cat_subcats is non zero to reduce the list of cl_from Or in generally reduce the batch size for the first query which gets the cl_from to get a smaller list of "cl_from IN" I am wonder why the query contains a '' (empty string) in the IN clause, there should be integer all over the page ids. The cl_from are from the page table from a previous select. Following the cat tree is always expensive and done on wmflabs for this purpose (PetScan) TASK DETAIL https://phabricator.wikimedia.org/T260232 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Umherirrender Cc: Umherirrender, DannyS712, Naike, WDoranWMF, Krinkle, aaron, Reedy, Ladsgroup, Aklapper, Marostegui, XeroS_SkalibuR, jannee_e, CBogen, Akuckartz, Adidsone1, darthmon_wmde, holger.knust, EvanProdromou, Nandana, Namenlos314, Phukettaxigroup, Lahi, Gq86, Darkminds3113, Lucas_Werkmeister_WMDE, GoranSMilovanovic, Jayprakash12345, Lunewa, QZanden, EBjune, merbst, LawExplorer, Vali.matei, _jensen, rosalieper, Agabi10, Scott_WUaS, Pchelolo, Jonas, Xmlizer, Volker_E, gnosygnu, jkroll, Wikidata-bugs, Jdouglas, aude, Tobias1984, GWicke, Dcljr, Dinoguy1000, Manybubbles, Mbch331, Rxy, Jay8g
_______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs