MySQL Forums
Forum List  »  Performance

MYSql Query - #2013 - Lost connection to MySQL server during query
Posted by: gourav kaila
Date: August 27, 2015 01:50PM

Hi, i am new to MYSql and PHP and using this in my product. I have a long query with multiple joins that has been timing out. I need urgent help to get this running asap. Please help.

* What i have tried already- I have already create the Sponsor_Id (being used in where) in all the sponsor tables as Index.
* Profiler chart shows horrible slowness (75% time in sending data)
----------

Here is the query if you could suggest somethin-


SELECT GROUP_CONCAT(DISTINCT masterdetail.eventid) as eventids FROM tblsponsor_slave_eventprefrencesdetail userprefrence INNER JOIN tblsponsor_slave_sponsor_eventprefrence_category userprefcategory ON userprefrence.SponsorId = userprefcategory.SponsorId INNER JOIN tblsponsor_slave_sponsor_eventprefrence_locationtarget userpreflocation ON userprefrence.SponsorId = userpreflocation.SponsorId INNER JOIN tblsponsor_slave_sponsor_eventprefrence_type userprefEventType ON userprefrence.SponsorId = userprefEventType.SponsorId INNER JOIN tblsponsor_slave_sponsor_eventprefrence_audienceprofile userprefAudiProfile ON userprefrence.SponsorId = userprefAudiProfile.SponsorId INNER JOIN tblsponsor_slave_sponsor_eventprefrence_industry userprefIndustry ON userprefrence.SponsorId = userprefIndustry.SponsorId INNER JOIN tblsponsor_slave_eventprefrencesdetail userprefdetail ON userprefrence.SponsorId=userprefdetail.SponsorId INNER JOIN tblsponsor_slave_sponsor_eventprefrence_audiencetype userprefAudiType ON userprefrence.SponsorId=userprefAudiType.SponsorId INNER JOIN tblsponsor_slave_eventprefrence_agegroup userprefAgeGroup ON userprefrence.SponsorId=userprefAgeGroup.SponsorId INNER JOIN tblevent_slave_event_address_city eventcity ON userpreflocation.Sponsor_EventPrefrence_LocationTarget = eventcity.Event_Address_City INNER JOIN tblevent_slave_event_audienceprofile eventAudiProfile ON userprefAudiProfile.Sponsor_EventPrefrence_AudienceProfile = eventAudiProfile.Event_AudienceProfile INNER JOIN tblevent_slave_event_industrycatered eventindustry ON userprefIndustry.Sponsor_EventPrefrence_Industry = eventindustry.Event_IndustryCatered INNER JOIN tblevent_slave_agegroup eventagegroup ON userprefAgeGroup.Sponsor_AgeGroup_Type=eventagegroup.Event_AgeGroup_Type AND userprefAgeGroup.IsExist=eventagegroup.IsExist INNER JOIN tblevent_master_detail masterdetail ON eventcity.EventId = masterdetail.EventId INNER JOIN tblevent_slave_others eventothers on masterdetail.EventId=eventothers.EventId AND masterdetail.Event_Category = userprefcategory.Sponsor_EventPrefrence_Category AND masterdetail.Event_Type=userprefEventType.Sponsor_EventPrefrence_Type AND eventothers.Event_Gender=userprefdetail.Sponsor_EventPrefrence_Gender AND eventothers.Event_TargetAudience=userprefAudiType.Sponsor_EventPrefrence_AudienceType AND eventothers.Event_Sponsor_Range_Min < userprefrence.Sponsor_EventPrefrence_Range_Max WHERE userprefrence.SponsorId =164 AND eventagegroup.IsExist=1 AND masterdetail.Event_StartDateTime > '2015-08-27' AND masterdetail.Event_Category in ("1","2","3","7","9","10","11") AND eventcity.Event_Address_City in ("1","3","54") AND masterdetail.Event_Type in ("2","3","4","5","7") AND eventindustry.Event_IndustryCatered in ("13","18") AND eventAudiProfile.Event_AudienceProfile in ("1","2","10")

Options: ReplyQuote


Subject
Views
Written By
Posted
MYSql Query - #2013 - Lost connection to MySQL server during query
1670
August 27, 2015 01:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.