From 8b8d9b839e2d122a087426b3c5af44b368b4e560 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Tue, 24 Oct 2017 22:42:40 +0200 Subject: [PATCH] chore: mysql slow query log reveals which queries do not use indexes ;) --- tools/regexor-for-slow-queries.php | 30 ++++++++++++++++++++++++++++++ tools/regexor-slow.sql | 0 2 files changed, 30 insertions(+) create mode 100644 tools/regexor-for-slow-queries.php create mode 100644 tools/regexor-slow.sql diff --git a/tools/regexor-for-slow-queries.php b/tools/regexor-for-slow-queries.php new file mode 100644 index 00000000..fc31a77b --- /dev/null +++ b/tools/regexor-for-slow-queries.php @@ -0,0 +1,30 @@ + 5\n[^A-Za-z]+ORDER BY totalpop DESC, totalvillages DESC, userid DESC;\n/', + '/SELECT \* FROM s1_medal order by week DESC LIMIT 0, 1;\n/', + '/SELECT \* FROM s1_vdata WHERE maxstore < \d{0,100} OR maxcrop < \d{0,100};\n/', + '/SELECT \* FROM s1_vdata WHERE wood > maxstore OR clay > maxstore OR iron > maxstore OR crop > maxcrop;\n/', + '/SELECT \* FROM s1_vdata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0;\n/', + '/SELECT uid FROM s1_deleting where timestamp < 1508874978;\n/', + '/SELECT \* FROM s1_vdata where starv != 0 and owner != 3;\n/', + '/SELECT \* FROM s1_vdata where celebration < \d{0,100} AND celebration != 0;\n/', + '/SELECT \* FROM s1_vdata WHERE loyalty<>100;\n/', + '/SELECT uid FROM s1_deleting where timestamp < \d{0,100};\n/', + '/SELECT Count\(\*\) as Total FROM s1_users WHERE timestamp > \d{0,100} AND tribe!=0 AND tribe!=4 AND tribe!=5;\n/', + ]; + + echo preg_replace($regexes, '', $src); +?> diff --git a/tools/regexor-slow.sql b/tools/regexor-slow.sql new file mode 100644 index 00000000..e69de29b