From a0f1ec852a987fb587cc07dc6910000c925db50d Mon Sep 17 00:00:00 2001 From: jasonmarlin Date: Thu, 17 Jan 2019 20:27:10 -0500 Subject: [ticket/15941] Replace MAX SQL in functions_posting.php Replace MAX SQL function with faster query using order by and limit. The ajacent query could also be optimized to eliminate the usage of MAX. Note that adding a compound key as suggested by EXPLAIN SQL yields an improvement, but not nearly as fast as ORDER + LIMIT. PHPBB3-15941 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_posting.php') diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 3640f543d9..8ca483f53a 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -200,7 +200,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $topic_condition = ''; } - if (count($ids) == 1) + if (count($ids) === 1) { $sql = 'SELECT p.post_id as last_post_id FROM ' . POSTS_TABLE . " p $topic_join -- cgit v1.2.1