]> git.wh0rd.org Git - tt-rss.git/commitdiff
add a very obvious speed improvement to topmost_id calculation
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 4 Aug 2015 17:38:43 +0000 (20:38 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 4 Aug 2015 17:38:43 +0000 (20:38 +0300)
include/functions2.php

index 9e4f0b0e09f85d670a03aa33773538e04af12b2a..1898aa2eac995044262222061b872d8e960a42d0 100644 (file)
                                if ($feed == -3)
                                        $first_id_query_strategy_part = "true";
 
+                               if (DB_TYPE == "pgsql") {
+                                       $sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND";
+                               } else {
+                                       $sanity_interval_qpart = "date_entered >= DATE_SUB(NOW(), INTERVAL 1 hour) AND";
+                               }
+
                                if (!$search) {
                                        // if previous topmost article id changed that means our current pagination is no longer valid
                                        $query = "SELECT DISTINCT
                                                $search_query_part
                                                $start_ts_query_part
                                                $since_id_part
+                                               $sanity_interval_qpart
                                                $first_id_query_strategy_part ORDER BY $order_by LIMIT 1";
 
                                        if ($_REQUEST["debug"]) {