решено Board maintenance PHP Fatal error: DB Error [includes/functions_admin.php

zxc

Пользователь
Сегодня не отработали несколько крон задач.
Проблема решилась добавлением
DB()->query('SET SQL_BIG_SELECTS=1');
перед проблемным запросом

Кто скажет почему так случилось? Связано ли это с тем, что количество записей в базе перевалило за миллион?

в логах
Код:
[14-Dec-2016 15:28:10 Europe/Moscow] PHP Fatal error:  DB Error [includes/functions_admin.php(108)] in /var/www/zns/data/www/xxx.ru/includes/db/mysql.php on line 802

Код:
INSERT INTO tmp_sync_topics SELECT t.topic_id, COUNT(p.post_id) AS total_posts, MIN(p.post_id) AS topic_first_post_id, MAX(p.post_id) AS topic_last_post_id, MAX(p.post_time) AS topic_last_post_time, IF(MAX(a.attach_id), 1, 0) AS topic_attachment FROM bb_topics t LEFT JOIN bb_posts p ON(p.topic_id = t.topic_id) LEFT JOIN bb_attachments a ON(a.post_id = p.post_id) WHERE t.topic_status != 2 GROUP BY t.topic_id

Source  : includes/functions_admin.php(108) :: db1.xxxtracker
IP      : 96.216.122.187
Date    : 2016-12-14 15:28:08
Agent   : Wget/1.12 (linux-gnu)
Req_URI : /cron.php
Referer :
Method  : GET
PID     : 09454
Request : Array
(
)______________________________________________________________________________

#001104 The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay

INSERT INTO tmp_sync_topics SELECT t.topic_id, COUNT(p.post_id) AS total_posts, MIN(p.post_id) AS topic_first_post_id, MAX(p.post_id) AS topic_last_post_id, MAX(p.post_time) AS topic_last_post_time, IF(MAX(a.attach_id), 1, 0) AS topic_attachment FROM bb_topics t LEFT JOIN bb_posts p ON(p.topic_id = t.topic_id) LEFT JOIN bb_attachments a ON(a.post_id = p.post_id) WHERE t.topic_status != 2 GROUP BY t.topic_id

Source  : includes/functions_admin.php(108) :: db1.xxxtracker
IP      : 46.163.16.161
Date    : 2016-12-14 15:28:10
Agent   : Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Req_URI : /admin/admin_cron.php?mode=run&id=4
Referer :
Method  : GET
PID     : 10079
Request : Array
(
    [mode] => run
    [id] => 4
)______________________________________________________________________________
 
Последнее редактирование:

zxc

Пользователь
в slow query
Код:
1481719133 | 12-14 15:38:53 | 16     | 0.8  | 12139 | db1 | INSERT INTO tmp_sync_topics SELECT t.topic_id, COU [...cut...] _id) WHERE t.topic_status != 2 GROUP BY t.topic_id # Records: 15114 Duplicates: 0 Warnings: 0 # includes/functions_admin.php(109) cron
 

zxc

Пользователь
Просьба ко всем у кого больше 15 тыс топиков выполнить этот запрос
Код:
SELECT t.topic_id, COUNT(p.post_id) AS total_posts, MIN(p.post_id) AS topic_first_post_id, MAX(p.post_id) AS topic_last_post_id, MAX(p.post_time) AS topic_last_post_time, IF(MAX(a.attach_id), 1, 0) AS topic_attachment FROM bb_topics t LEFT JOIN bb_posts p ON(p.topic_id = t.topic_id) LEFT JOIN bb_attachments a ON(a.post_id = p.post_id) WHERE t.topic_status != 2 GROUP BY t.topic_id

И напишите сколько записей выдало и время выполнения запроса
 

zxc

Пользователь
Ну это не решение. Тут скорее надо разбивать запрос, а то с ростом базы выборка при синхронизации все больше. Это ладно у меня всего 15 тыс тем. Мне интересно сколько по времени отрабатывает board maintenance у тех у кого больше 100тыс тем
 
Последнее редактирование:

Dr_Brown

Пользователь
у меня 124 тысячи отрабатывает 10 мин 54 сек

а на втором треке на котором вчера сделал оптимизу табле выполнилась сегодня за 29 сек при 147 тыс раздач

slow query тоже присутствует.

задача по аттачам вообще отключена. Так ка он вообще на слабых вдс может по 1,5 часа выполняться
 
Последнее редактирование:

Exile

Администратор
The SELECT would examine more than MAX_JOIN_SIZE rows - проблема-то вот, запрос тяжеловат, вот и не проходит. Пока только реально правка конфига, потом проблемы не будет такой.
 
Сверху