How to increase performance of complicated MySQL select query? -


i working on project management tool , while generating reports through admin end loading time data database > 5 minutes. there few points know me increase performance right need have in select query

select timesheet_client.organisation client_name, timesheet_project.title project_name,   timesheet_task.name task, concat(timesheet_user.first_name, ' ', timesheet_user.last_name) resource_name,   timesheet_user.bill_factor, timesheet_client.client_type, sum(spent) spent, sum(delivered_hours) delivered_hours,    sum(billable_hours) billable_hours, comments, color, lock_color, updated_by, updated_by_date, timesheet_user_psdb.grp_id,    timesheet_user_psdb.client_id, timesheet_user_psdb.proj_id, timesheet_user_psdb.task_id, timesheet_user_psdb.uid,    timesheet_user_grp.grp_name timesheet_user_psdb,timesheet_user, timesheet_client,    timesheet_project,timesheet_task,timesheet_user_grp timesheet_user.username=timesheet_user_psdb.uid ,   timesheet_client.client_id=timesheet_user_psdb.client_id , timesheet_project.proj_id=timesheet_user_psdb.proj_id ,   timesheet_task.task_id = timesheet_user_psdb.task_id , timesheet_user_grp.grp_id=timesheet_user_psdb.grp_id , month =3   , year = 2017 , month!='' , timesheet_user_psdb.client_id=326   group timesheet_user_psdb.task_id,timesheet_user_psdb.uid order timesheet_client.client_type desc,timesheet_client.organisation,timesheet_user_psdb.proj_id,   timesheet_user_psdb.task_id,timesheet_user.uid,timesheet_user_psdb.task_id; 

i have used index on primary keys.

explain output: explain results above statement

help highly appreciable.

give try:

select      tc.organisation client_name,      tp.title project_name,     tt.name task,      concat(tu.first_name, ' ', tu.last_name) resource_name,     tu.bill_factor,      tc.client_type, sum(spent) spent, -- should specify table comes     sum(delivered_hours) delivered_hours, -- should specify table comes     sum(billable_hours) billable_hours, -- should specify table comes     comments, -- should specify table comes     color, -- should specify table comes     lock_color, -- should specify table comes     updated_by, -- should specify table comes     updated_by_date, -- should specify table comes     tup.grp_id,      tup.client_id,      tup.proj_id,      tup.task_id,      tup.uid,      tug.grp_name         timesheet_user tu         left outer join      timesheet_user_psdb tup         on tu.username = tup.uid         left outer join     timesheet_user_grp tug         on tup.grp_id = tug.grp_id         left outer join          timesheet_client tc         on tup.client_id = tc.client_id         left outer join     timesheet_project tp         on tup.proj_id = tp.proj_id         left outer join     timesheet_task tt         on tup.task_id = tt.task_id       month = 3 , -- should specify table comes     year = 2017 , -- should specify table comes     month != '' , -- should specify table comes     tup.client_id = 326   group      tup.task_id,     tup.uid order      tc.client_type desc,     tc.organisation,     tup.proj_id,     tup.task_id,     tu.uid,     tup.task_id; 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -