From: Roland Haeder Date: Mon, 12 Aug 2013 18:38:24 +0000 (+0000) Subject: No more ORDER BY required, cool. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cd6d6385f63a9634d7723c7ccdc11d6df3d6a744;p=ctracker.git No more ORDER BY required, cool. --- diff --git a/libs/lib_connect.php b/libs/lib_connect.php index 0af17e8..975ffc4 100644 --- a/libs/lib_connect.php +++ b/libs/lib_connect.php @@ -312,7 +312,7 @@ function isCrackerTrackerIpSuspicious () { } // END - if // We only need the very last attempt to get! - $result = runCrackerTrackerSql("SELECT SQL_SMALL_RESULT COUNT(`id`) AS `cnt` FROM `ctracker_data` USE INDEX (`remote_proxy_last`) WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' OR `proxy_addr`='" . getenv('REMOTE_ADDR') . "' ORDER BY `last_attempt` DESC LIMIT 1", __FUNCTION__, __LINE__); + $result = runCrackerTrackerSql("SELECT SQL_SMALL_RESULT COUNT(`id`) AS `cnt` FROM `ctracker_data` USE INDEX (`remote_proxy_last`) WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' OR `proxy_addr`='" . getenv('REMOTE_ADDR') . "' LIMIT 1", __FUNCTION__, __LINE__); // Get row count list($rows) = mysql_fetch_row($result); diff --git a/libs/lib_updates.php b/libs/lib_updates.php index 436d676..f844742 100644 --- a/libs/lib_updates.php +++ b/libs/lib_updates.php @@ -70,7 +70,7 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] . // Better key for always repeating query 3 => array( - 'ALTER TABLE `ctracker`.`ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr`, `last_attempt` DESC )', + 'ALTER TABLE `ctracker`.`ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr` )', ), ); }