[ticket/16940] Optimize phpBB Native Search

- Use `ORDER BY post_id ASC` for batch posts.

PHPBB3-16940
This commit is contained in:
Dark❶ 2021-12-13 19:36:36 +05:30
parent cccf01447f
commit c7856ce162
No known key found for this signature in database
GPG key ID: B5C35684F456E634

View file

@ -322,7 +322,8 @@ class acp_search
{ {
$sql = 'SELECT post_id, poster_id, forum_id $sql = 'SELECT post_id, poster_id, forum_id
FROM ' . POSTS_TABLE . ' FROM ' . POSTS_TABLE . '
WHERE post_id > ' . (int) $post_counter; WHERE post_id > ' . (int) $post_counter . '
ORDER BY post_id ASC';
$result = $db->sql_query_limit($sql, $this->batch_size); $result = $db->sql_query_limit($sql, $this->batch_size);
$ids = $posters = $forum_ids = array(); $ids = $posters = $forum_ids = array();
@ -392,7 +393,8 @@ class acp_search
{ {
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
FROM ' . POSTS_TABLE . ' FROM ' . POSTS_TABLE . '
WHERE post_id > ' . (int) $post_counter; WHERE post_id > ' . (int) $post_counter . '
ORDER BY post_id ASC';
$result = $db->sql_query_limit($sql, $this->batch_size); $result = $db->sql_query_limit($sql, $this->batch_size);
$buffer = $db->sql_buffer_nested_transactions(); $buffer = $db->sql_buffer_nested_transactions();