+ Reply to Thread
Results 1 to 1 of 1

Thread: Closed

  1. #1
    Senior Member
    Join Date
    Dec 2011
    Posts
    159

    Exclamation Query problem that increase server load

    I was told that I either need to alter this query so that it is not looking through as much of this database, or you may need to consider upgrading the server to provide further resources for this query to utilize.

    Dear Tech team,
    Can you please advise


    ======================


    SELECT SQL_CALC_FOUND_ROWS DISTINCT `T1`.*, `T1`.`Shows`, `T3`.`Path` AS `Path`, `T3`.`Key` AS `Key`, `T3`.`Type` AS `Listing_type`, IF( `T1`.`Sub_status`='invisible' OR `T1`.`Sub_status` = 'visible', SUBSTRING_INDEX(GROUP_CONCAT(DISTINCT `T6`.`Thumbnail` ORDER BY `T6`.`Type` DESC, `T6`.`ID` ASC), ',', 1), CONCAT( SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(DISTI NCT `T6`.`Thumbnail` ORDER BY `T6`.`Type` DESC, `T6`.`ID` ASC), ',', 1), '.', 1), '_', `T1`.`Sub_status` ,'_en', '.', SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(DISTI NCT `T6`.`Thumbnail` ORDER BY `T6`.`Type` DESC, `T6`.`ID` ASC), ',', 1), '.', -1))) AS `Main_photo` ,IF(UNIX_TIMESTAMP(DATE_ADD(`T1`.`Featured_date`, INTERVAL `T2`.`Listing_period` DAY)) > UNIX_TIMESTAMP(NOW()) OR `T2`.`Listing_period` = 0, '1', '0') `Featured` FROM `fl_listings` AS `T1` LEFT JOIN `fl_listing_plans` AS `T2` ON `T1`.`Plan_ID` = `T2`.`ID` LEFT JOIN `fl_categories` AS `T3` ON `T1`.`Category_ID` = `T3`.`ID` LEFT JOIN `fl_listing_photos` AS `T6` ON `T1`.`ID` = `T6`.`Listing_ID` LEFT JOIN `fl_accounts` AS `T7` ON `T1`.`Account_ID` = `T7`.`ID` WHERE (UNIX_TIMESTAMP(DATE_ADD(`T1`.`Pay_date`, INTERVAL `T2`.`Listing_period` DAY)) > UNIX_TIMESTAMP(NOW()) OR `T2`.`Listing_period` = 0) AND `T1`.`Status` = 'active' AND `T7`.`Status` = 'active' AND (`T3`.`Type` = 'listings' OR FIND_IN_SET( `T3`.`Type` , 'listings') > 0 ) AND `T1`.`Sub_status` <> 'invisible' GROUP BY `T1`.`ID` ORDER BY `T1`.`Pay_date` DESC LIMIT 4
    Last edited by rosegarden; February 28, 2013 at 03:15 PM.

+ Reply to Thread