Slow query - Any suggestions?
Posted: Tue Jul 02, 2002 2:05 am
I am having problems with the following query, in particular with response times. It works well but is just slow.
My application is running on Apache and using MYSql.
In particular as the mysql database gets larger the query is getting slower (hmmmmm), I would appreciate it if someone can spot anything obviously wrong with the code.
Regards
Hebbs
My application is running on Apache and using MYSql.
In particular as the mysql database gets larger the query is getting slower (hmmmmm), I would appreciate it if someone can spot anything obviously wrong with the code.
Code: Select all
$query = "SELECT dat_a_mainrequest.AAA_Nr,RequestDate,list_reqstatus.RequestStatus,RequestType,Urgency,Offence,Commodity,RequesterRefNr,OR_Number,Reqperson_ID,Enqperson_ID,Surname,Given,OperationName,Caveat,RequestType,IFNULL(dat_tablea.SubEnqNr,dat_tableb.SubEnqNr)
FROM dat_a_mainrequest,type_rqst,list_requester,user_profile,dat_tablea,dat_tableb
LEFT JOIN list_projects ON dat_a_mainrequest.Operation_ID = list_projects.Operation_ID
LEFT JOIN list_reqstatus ON dat_a_mainrequest.ReqStatus_ID = list_reqstatus.ReqStatus_ID
WHERE dat_a_mainrequest.AAA_Nr = '$AAAnum'
AND (dat_tablea.SubEnqNr = '$subenqnr' OR dat_tableb.SubEnqNr = '$subenqnr')
AND dat_a_mainrequest.ReqType_ID = type_rqst.ReqType_ID
AND dat_a_mainrequest.Requestlocation_ID = list_requester.Requestlocation_ID
AND dat_a_mainrequest.Reqperson_ID = user_profile.User_ID
AND (dat_a_mainrequest.AAA_Nr = dat_tablea.AAA_Nr OR dat_a_mainrequest.AAA_Nr = dat_tableb.AAA_Nr)";Hebbs