Results 1 to 2 of 2

Thread: Optimizing the query with respect to doctrine

  1. #1
    Join Date
    Nov 2009
    Posts
    1

    Optimizing the query with respect to doctrine

    Code:
    SELECT DISTINCT y.company_id AS y__company_id, y.service_price AS y__service_price, y.print_service AS y__print_service, y.company_name_en AS y__company_name_en, y.gps_latitude AS y__gps_latitude, y.gps_longitude AS y__gps_longitude, y.company_name_ar AS y__company_name_ar, y.url AS y__url, (y.service_price4 + IFNULL((SELECT SUM(y2.revenue_actual) AS y2__0 FROM yp_comp_keywords_revenue y2 INNER JOIN yp_keyword_master y3 ON y2.keyword_id = y3.keyword_id WHERE ((y3.keyword_en = CONCAT("trading",'') OR FIND_IN_SET( CONCAT("trading",''),keyword_synonyms_en)) AND y2.company_id = y.company_id AND y2.start_date <= curdate() AND y2.end_date >= curdate()) GROUP BY y2.company_id), 0)) AS y__0, (y.print_service + 0) AS y__1, y.company_name_en AS y__2, y.keywordmaster_en AS y__3, y.company_keywords_en AS y__4, y.keyword_hide_en AS y__5 FROM yp_companies y WHERE 1 AND (MATCH(company_name_en,company_synonyms_en) AGAINST('"trading"' in BOOLEAN MODE) OR FIND_IN_SET( "trading" , company_keywords_en)) HAVING (y__0 > 0 OR y__1> 0) ORDER BY y__0 DESC, y.print_service DESC, y.company_name_en
    this is the explain plan of the query


    HTML Code:
    id  select_type  table  type  possible_keys  key  key_len  ref  rows  Extra  
    1 PRIMARY y ALL NULL NULL NULL NULL 211009 Using where; Using filesort 
    2 DEPENDENT SUBQUERY y2 ref company_id company_id 4 uae2009.y.company_id 3 Using where; Using index 
    2 DEPENDENT SUBQUERY y3 eq_ref PRIMARY,keyword_en,keyword_en_2 PRIMARY 4 uae2009.y2.keyword_id 1 Using where
    if i remove the order by clause , the query is little fast



    Please help me to solve the problem
    thanks in advance
    kavitha

  2. #2
    Join Date
    Nov 2009
    Posts
    1
    I have the same problem, hope someone helps with this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •