mysql,queue,execution-time,mysql-slow-query-log
There are no queues like you describe. When the query starts, the connection is dedicated to running it. It may be blocked by any of a large number of "mutexes" because of various things shared between connections. As the query runs, it may have to wait for I/O to read...
mysql,database,mysql-slow-query-log
It might be faster if you force it to use the primary key instead of doing a full table scan. Try doing SELECT tag FROM tags USE INDEX(PRIMARY) if you are using innodb. Alternatively, you could also just add WHERE tag_id > 0 to your query. From my understanding, innodb...
php,mysql,innodb,mysql-slow-query-log
It's using the wrong key instead of the index on the 3 columns. You can hint at indexes with USE KEY ... syntax. https://dev.mysql.com/doc/refman/5.1/en/index-hints.html You may also want to try reordering your key on the 3 columns. Generally, you want the most restricting column to be first in the index,...
Here is another version of your query select distinct e.EmployeeId FROM employees e left join attendance a on e.EmployeeId = a.EmployeeId and a.AttendanceDate = '2015-01-20' where e.status='Active' and e.BranchId= '2' and a.EmployeeId is null You will also need some indexes to be applied on the tables as alter table employees...
php,mysql,performance,innodb,mysql-slow-query-log
INSERT must update all the indexes for each row inserted. However, for a single row, we are talking milliseconds at most. INSERT ... SELECT ... can be inserting arbitrarily many rows -- either the SELECT or the INSERT could be the problem. INSERT ... VALUES (1,2,3), (4,5,6), ... (a 'batched'...
I find the slow to be the best source of what is bogging down the server. Suggest you start will a moderately high value of long_query_time. This will minimize the I/O and disk space. Fix the queries that it finds, if you can. When you have exhausted that, lower that...