diff options
author | Andrew Dolgov <[email protected]> | 2015-08-04 20:38:43 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-08-04 20:38:43 +0300 |
commit | 332ff5cfb8e52bb9a9f12a0d535c0f0c5e30397a (patch) | |
tree | a16a68f75f4eb7c06720028b7a45b00505d28bb0 | |
parent | 73ef6f0459883667f4459e4d7e165eb3e587bb9e (diff) |
add a very obvious speed improvement to topmost_id calculation
-rw-r--r-- | include/functions2.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/functions2.php b/include/functions2.php index 9e4f0b0e0..1898aa2ea 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -716,6 +716,12 @@ 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 @@ -739,6 +745,7 @@ $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"]) { |