[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:39:01 +05:30
parent ff6f7c4186
commit 6389a57633
No known key found for this signature in database
GPG key ID: B5C35684F456E634

View file

@ -452,8 +452,9 @@ abstract class base implements search_backend_interface
protected function get_posts_batch_after(int $post_id): \Generator protected function get_posts_batch_after(int $post_id): \Generator
{ {
$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 > ' . $post_id; WHERE post_id > ' . (int) $post_id . '
ORDER BY post_id ASC';
$result = $this->db->sql_query_limit($sql, self::BATCH_SIZE); $result = $this->db->sql_query_limit($sql, self::BATCH_SIZE);
while ($row = $this->db->sql_fetchrow($result)) while ($row = $this->db->sql_fetchrow($result))