An area for sysadmins does not exists, so I ask here. I put on logging slow sql queries. Here is an example that took 22 seconds:
Code:
SELECT t.uid AS t0_c0, t.users_name AS t0_c1, t.password AS t0_c2, t.full_name AS t0_c3, t.parent_id AS t0_c4, t.lang AS t0_c5, t.email AS t0_c6, t.htmleditormode AS t0_c7, t.templateeditormode AS t0_c8, t.questionselectormode AS t0_c9, t.one_time_pw AS t0_c10, t.dateformat AS t0_c11, t.last_login AS t0_c12, t.created AS t0_c13, t.modified AS t0_c14, t.validation_key AS t0_c15, t.validation_key_expiration AS t0_c16, t.last_forgot_email_password AS t0_c17, t.expires AS t0_c18, permissions.id AS t1_c0, permissions.entity AS t1_c1, permissions.entity_id AS t1_c2, permissions.uid AS t1_c3, permissions.permission AS t1_c4, permissions.create_p AS t1_c5, permissions.read_p AS t1_c6, permissions.update_p AS t1_c7, permissions.delete_p AS t1_c8, permissions.import_p AS t1_c9, permissions.export_p AS t1_c10 FROM lime_users t LEFT OUTER JOIN lime_permissions permissions ON (permissions.uid=t.uid) WHERE (((permissions.permission='superadmin') AND (permissions.read_p='1')) OR (t.uid=1));
And here is EXPLAIN of it+
+
+
+
+
+
+
+
+
+
+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+
+
+
+
+
+
+
+
+
+
+
| 1 | SIMPLE | t | ALL | PRIMARY | NULL | NULL | NULL | 1686 | |
| 1 | SIMPLE | permissions | ALL | NULL | NULL | NULL | NULL | 35429 | Using where; Using join buffer (flat, BNL join) |
+
+
+
+
+
+
+
+
+
+
+No index and 35000 rows sounds bad. But I can't catch when this happens, i.e. sometimes the system is slow and sometimes not. Anything I can do to make this faster?