Вот трассировка, что происходит при открытии подфорума из 12 тем 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467.
[root@dragon log]# cat trace_sql.log
----------------------------------------------------------------------
Started: /forum/forum.php?fid=64
----------------------------------------------------------------------
select
block_tor_ips, moderator_log, default_sender, receiver, whois_server, approval_required, hide_online_status,
dislikes_active, rates_active, dislikes_anonym, skin, max_poll_options,
max_message_length, max_pinned_topics, max_private_members,
max_att_size, max_att_size_audiovideo, max_messages_minute, max_messages_hour, max_messages_day,
max_topics_day, min_search_interval, max_rates_hour,
max_topic_name_symbols, max_user_name_symbols, hide_users_from_robots,
celebration_active, mourning_active, snow_effect, archive_mode
from v1_settings
execute_query() [include/_generic/ForumManager.class.php, 4519]
get_settings() [include/general_inc.php, 208]
require_once() [forum.php, 5]
Elapsed: 0ms
----------------------------------------------------------------------
select guest_name
from v1_protected_guests
order by guest_name
execute_query() [include/_generic/ForumManager.class.php, 4654]
get_settings() [include/general_inc.php, 208]
require_once() [forum.php, 5]
Elapsed: 0ms
----------------------------------------------------------------------
select last_activity from v1_read_marker_activity where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU='
execute_query() [include/_generic/ForumManager.class.php, 24912]
check_read_marker_last_activity() [include/_generic/ForumManager.class.php, 30312]
read_user_cookies() [include/general_inc.php, 210]
require_once() [forum.php, 5]
Elapsed: 0ms
----------------------------------------------------------------------
select id, password from v1_forum where protected_by_password = 1
execute_query() [include/_generic/ForumManager.class.php, 30477]
read_user_cookies() [include/general_inc.php, 210]
require_once() [forum.php, 5]
Elapsed: 0ms
----------------------------------------------------------------------
select read_marker, author
from v1_read_marker_activity
where (current_name_start > '2023-09-12 12:50:47' or current_name_hits < 500)
and author is not NULL
execute_query() [include/_generic/ForumManager.class.php, 5744]
update_user_status() [include/general_inc.php, 214]
require_once() [forum.php, 5]
Elapsed: 35ms
----------------------------------------------------------------------
select block_expires, block_reason
from v1_ip_blocked
where ip = '193.26.135.2' and tp = 'ip'
execute_query() [include/_generic/ForumManager.class.php, 5770]
update_user_status() [include/general_inc.php, 214]
require_once() [forum.php, 5]
Elapsed: 1ms
----------------------------------------------------------------------
select v1_forum.id, name, description, v1_forum.creation_date,
user_posting_as_guest,
topic_count, topic_count_total,
last_message_date,
v1_forum.deleted, closed,
v1_post.user_id, v1_post.author, v1_user.user_name, v1_post.read_marker,
last_visit_date, logout
from v1_forum
inner join v1_forum_statistics on (v1_forum.id = v1_forum_statistics.forum_id)
left join v1_post on (v1_forum_statistics.last_message_id = v1_post.id)
left join v1_user on (v1_post.user_id = v1_user.id)
where v1_forum.name <> 'PRIVATE_MESSAGES' and restricted_access = 0
order by sort_order, name
execute_query() [include/_generic/ForumManager.class.php, 2374]
get_forum_list() [include/general_inc.php, 218]
require_once() [forum.php, 5]
Elapsed: 2ms
----------------------------------------------------------------------
select user_id, forum_id, user_name,
last_visit_date, logout
from
v1_forum_moderator
inner join v1_user on (v1_forum_moderator.user_id = v1_user.id)
order by user_name
execute_query() [include/_generic/ForumManager.class.php, 2434]
get_forum_list() [include/general_inc.php, 218]
require_once() [forum.php, 5]
Elapsed: 1ms
----------------------------------------------------------------------
select block_level from v1_tor_ips where ip = '193.26.135.2'
execute_query() [include/_generic/ForumManager.class.php, 38703]
check_tor_ip() [forum.php, 7]
Elapsed: 0ms
----------------------------------------------------------------------
select id from v1_forum where name = 'PRIVATE_MESSAGES'
execute_query() [include/_generic/ForumManager.class.php, 25078]
get_private_forum_id() [forum.php, 18]
Elapsed: 0ms
----------------------------------------------------------------------
select
id, name, description, no_guests, restricted_guest_mode, user_posting_as_guest, stringent_rules, allow_edit, restricted_access, hide_from_robots, sort_order,
access_duration, access_message_count, disable_ignore,
protected_by_password, deleted, closed, topic_count topic_count
from v1_forum
inner join v1_forum_statistics on (v1_forum.id = v1_forum_statistics.forum_id)
where id = 64
execute_query() [include/_generic/ForumManager.class.php, 3815]
get_forum_data() [forum.php, 49]
Elapsed: 1ms
----------------------------------------------------------------------
select user_id, forum_id, user_name,
last_visit_date, logout
from
v1_forum_moderator
inner join v1_user on (v1_forum_moderator.user_id = v1_user.id)
where forum_id = 64
order by user_name
execute_query() [include/_generic/ForumManager.class.php, 3925]
get_forum_data() [forum.php, 49]
Elapsed: 1ms
----------------------------------------------------------------------
select id, password, protected_by_password, v1_forum_moderator.forum_id is_moderator
from v1_forum
left join v1_forum_moderator on (v1_forum.id = v1_forum_moderator.forum_id and user_id = 0)
where v1_forum.id = 64
execute_query() [include/_generic/ForumManager.class.php, 2316]
need_forum_password() [forum.php, 60]
Elapsed: 0ms
----------------------------------------------------------------------
select name, deleted, protected_by_password, restricted_access from v1_forum where id = 64
execute_query() [include/_generic/ForumManager.class.php, 2154]
has_access_to_forum() [forum.php, 67]
Elapsed: 0ms
----------------------------------------------------------------------
select block_expires
from v1_forum_blocked
where user_id = 0 and forum_id = 64
execute_query() [include/_generic/ForumManager.class.php, 2202]
has_access_to_forum() [forum.php, 67]
Elapsed: 0ms
----------------------------------------------------------------------
select 1 from v1_forum where v1_forum.id = 64 and v1_forum.name <> 'PRIVATE_MESSAGES' and restricted_access = 0
execute_query() [include/_generic/ForumManager.class.php, 2256]
has_access_to_forum() [forum.php, 67]
Elapsed: 0ms
----------------------------------------------------------------------
BEGIN
execute_query() [include/MySQL/MySQL_DBWorker.class.php, 463]
start_transaction() [include/_generic/ForumManager.class.php, 27232]
update_forum_read_status() [forum.php, 99]
Elapsed: 0ms
----------------------------------------------------------------------
update v1_forum_read_markers
set last_activity = '2023-09-12 14:50:47', ip = '193.26.135.2'
where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU='
execute_query() [include/_generic/ForumManager.class.php, 27241]
update_forum_read_status() [forum.php, 99]
Elapsed: 1ms
----------------------------------------------------------------------
update v1_read_marker_activity
set current_name_hits = 0, current_name_start = '2023-09-12 14:50:47'
where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=' and (author is NULL or author <> NULL)
execute_query() [include/_generic/ForumManager.class.php, 27251]
update_forum_read_status() [forum.php, 99]
Elapsed: 0ms
----------------------------------------------------------------------
update v1_read_marker_activity
set last_activity = '2023-09-12 14:50:47', ip = '193.26.135.2', hits = hits + 1, current_name_hits = current_name_hits + 1,
author = author, user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.1.1269 (corp) Yowser/2.5 Safari/537.36'
where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU='
execute_query() [include/_generic/ForumManager.class.php, 27268]
update_forum_read_status() [forum.php, 99]
Elapsed: 0ms
----------------------------------------------------------------------
COMMIT
execute_query() [include/MySQL/MySQL_DBWorker.class.php, 469]
commit_transaction() [include/_generic/ForumManager.class.php, 27343]
update_forum_read_status() [forum.php, 99]
Elapsed: 2ms
----------------------------------------------------------------------
insert into v1_forum_read_markers
(forum_id, read_marker, first_read_date, first_activity, last_activity, ip)
select
64, 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=', '2023-09-12 14:50:47', '2023-09-12 14:50:47', '2023-09-12 14:50:47', '193.26.135.2'
from v1_dual
where not exists (select 1 from v1_forum_read_markers where forum_id = 64 and read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=')
execute_query() [include/_generic/ForumManager.class.php, 27376]
update_forum_read_status() [forum.php, 99]
Elapsed: 0ms
----------------------------------------------------------------------
insert into v1_read_marker_activity
(read_marker, ip, first_activity, last_activity, current_name_start, author, user_agent, hits, current_name_hits)
select
'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=', '193.26.135.2', '2023-09-12 14:50:47', '2023-09-12 14:50:47', '2023-09-12 14:50:47', NULL, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.1.1269 (corp) Yowser/2.5 Safari/537.36', 0, 0
from v1_dual
where not exists (select 1 from v1_read_marker_activity where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=')
execute_query() [include/_generic/ForumManager.class.php, 27388]
update_forum_read_status() [forum.php, 99]
Elapsed: 0ms
----------------------------------------------------------------------
select id from v1_forum where name = 'PRIVATE_MESSAGES'
execute_query() [include/_generic/ForumManager.class.php, 25078]
get_private_forum_id() [include/_generic/ForumManager.class.php, 34052]
get_forum_topics() [forum.php, 104]
Elapsed: 0ms
----------------------------------------------------------------------
select v1_topic.id, v1_topic.name, v1_topic.creation_date,
v1_topic_statistics.last_message_date,
v1_topic_statistics.post_count,
v1_topic_statistics.post_count_total,
v1_topic_statistics.hits_count,
v1_topic_statistics.bot_hits_count,
v1_topic.profiled_topic,
v1_topic.deleted, v1_topic.closed, v1_topic.pinned, v1_topic.publish_delay, has_pinned_post,
v1_forum.deleted forum_deleted,
v1_topic.user_id, v1_topic.author, v1_user.user_name, v1_topic.read_marker,
v1_user.last_visit_date, v1_user.logout,
forum_id, v1_forum.name forum_name, is_poll
from v1_topic
inner join v1_topic_statistics on (v1_topic.id = v1_topic_statistics.topic_id)
inner join v1_forum on (v1_topic.forum_id = v1_forum.id)
left join v1_user on (v1_topic.user_id = v1_user.id)
where v1_topic.forum_id = 64 and v1_topic.deleted + v1_forum.deleted = 0
and (v1_topic.pinned = 1 )
order by v1_topic.publish_delay, v1_topic_statistics.last_message_date desc, v1_topic.id desc
execute_query() [include/_generic/ForumManager.class.php, 34274]
get_forum_topics() [forum.php, 104]
Elapsed: 1ms
----------------------------------------------------------------------
select
v1_topic.id, v1_topic.name, v1_topic.creation_date,
v1_topic_statistics.last_message_date,
v1_topic_statistics.post_count,
v1_topic_statistics.post_count_total,
v1_topic_statistics.hits_count,
v1_topic_statistics.bot_hits_count,
v1_topic.profiled_topic,
v1_topic.deleted, v1_topic.closed, v1_topic.pinned, v1_topic.publish_delay, has_pinned_post,
v1_forum.deleted forum_deleted,
v1_topic.user_id, v1_topic.author, v1_topic.read_marker, v1_user.user_name,
v1_user.last_visit_date, v1_user.logout,
forum_id, v1_forum.name forum_name, is_poll, v1_topic.no_guests
from v1_topic
inner join v1_topic_statistics force index (v1_topic_statistics_lmdate_idx) on (v1_topic.id = v1_topic_statistics.topic_id)
inner join v1_forum on (v1_topic.forum_id = v1_forum.id)
left join v1_user on (v1_topic.user_id = v1_user.id)
where v1_topic.forum_id = 64 and v1_topic.deleted + v1_forum.deleted = 0
and v1_topic.pinned + v1_topic.publish_delay = 0
order by v1_topic_statistics.last_message_date desc
limit 0, 38
execute_query() [include/_generic/ForumManager.class.php, 34359]
get_forum_topics() [forum.php, 104]
Elapsed: 6027ms
----------------------------------------------------------------------
select v1_topic.id, forum_id,
v1_post.user_id last_author_id, v1_post.author last_author, v1_post.read_marker last_author_readmarker,
last_user.last_visit_date last_user_last_visit_date, last_user.logout last_user_logout
from
v1_topic
inner join v1_topic_statistics on (v1_topic.id = v1_topic_statistics.topic_id)
left join v1_post on (v1_topic_statistics.last_message_id = v1_post.id)
left join v1_user last_user on (v1_post.user_id = last_user.id)
where v1_topic.id in (2186819,2186818,2186837,2186822,2186830,2186841,2186823,2186832,2186824,2186833,2186825,2186829)
execute_query() [include/_generic/ForumManager.class.php, 34438]
get_forum_topics() [forum.php, 104]
Elapsed: 1ms
----------------------------------------------------------------------
select topic_id, participant_id, user_name,
v1_user.last_visit_date, v1_user.logout
from v1_private_topics
inner join v1_user on (v1_private_topics.participant_id = v1_user.id)
where topic_id in (2186819,2186818,2186837,2186822,2186830,2186841,2186823,2186832,2186824,2186833,2186825,2186829)
order by v1_private_topics.last_visit_date desc
execute_query() [include/_generic/ForumManager.class.php, 34467]
get_forum_topics() [forum.php, 104]
Elapsed: 0ms
----------------------------------------------------------------------
select topic_id, user_id, user_name,
last_visit_date, logout
from v1_topic_moderator
inner join v1_user on (v1_topic_moderator.user_id = v1_user.id)
where topic_id in (2186819,2186818,2186837,2186822,2186830,2186841,2186823,2186832,2186824,2186833,2186825,2186829)
order by user_name
execute_query() [include/_generic/ForumManager.class.php, 34493]
get_forum_topics() [forum.php, 104]
Elapsed: 0ms
----------------------------------------------------------------------
select topic_id
from
v1_post
inner join v1_topic on (v1_post.topic_id = v1_topic.id)
where v1_post.creation_date >= '2023-09-12 13:50:53'
group by topic_id
having count(*) >= 15 and count(distinct v1_post.author) > 2
execute_query() [include/_generic/ForumManager.class.php, 34520]
get_forum_topics() [forum.php, 104]
Elapsed: 0ms
----------------------------------------------------------------------
select topic_id
from
v1_post
inner join v1_topic on (v1_post.topic_id = v1_topic.id)
where v1_post.creation_date >= '2023-09-11 14:50:53'
group by topic_id
having count(*) >= 100 and count(distinct v1_post.author) > 2
execute_query() [include/_generic/ForumManager.class.php, 34544]
get_forum_topics() [forum.php, 104]
Elapsed: 1ms
----------------------------------------------------------------------
select id topic_id from v1_topic where id in (-1) and id in (2186819,2186818,2186837,2186822,2186830,2186841,2186823,2186832,2186824,2186833,2186825,2186829)
execute_query() [include/_generic/ForumManager.class.php, 34590]
get_forum_topics() [forum.php, 104]
Elapsed: 0ms
----------------------------------------------------------------------
select id topic_id from v1_topic where id in (-1) and id in (2186819,2186818,2186837,2186822,2186830,2186841,2186823,2186832,2186824,2186833,2186825,2186829)
execute_query() [include/_generic/ForumManager.class.php, 34615]
get_forum_topics() [forum.php, 104]
Elapsed: 0ms
----------------------------------------------------------------------
select count(*) cnt, min(creation_date) first_topic_date
from v1_topic
where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=' and creation_date >= '2023-09-11 14:50:53' and publish_delay <> 1 and is_private < 1
execute_query() [include/_generic/ForumManager.class.php, 24859]
check_topic_limit() [forum.php, 144]
Elapsed: 0ms
----------------------------------------------------------------------
insert into v1_forum_hits (forum_id, topic_id, dt, user_id, hits_count, duration, guest_name, user_agent, uri, ip, read_marker, browser, os, bot)
values
(64, NULL, '2023-09-12 14:50:53', NULL, 1, 134, NULL, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.1.1269 (corp) Yowser/2.5 Safari/537.36', 'forum.php?fid=64&trace_sql=1', '193.26.135.2', 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=', 'Yandex Browser', 'Windows 10', NULL)
execute_query() [include/_generic/ForumManager.class.php, 27022]
track_hit() [forum.php, 146]
Elapsed: 6ms
----------------------------------------------------------------------
update v1_read_marker_activity
set current_name_hits = 0, current_name_start = '2023-09-12 14:50:53'
where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU=' and (author is NULL or author <> NULL)
execute_query() [include/_generic/ForumManager.class.php, 27031]
track_hit() [forum.php, 146]
Elapsed: 0ms
----------------------------------------------------------------------
update v1_read_marker_activity
set last_activity = '2023-09-12 14:50:53', ip = '193.26.135.2', hits = hits + 1, current_name_hits = current_name_hits + 1,
author = author, user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.1.1269 (corp) Yowser/2.5 Safari/537.36'
where read_marker = 'OTU0ZWI1234jYTg2NGM2NGVlMWU2NjlkZmFiMDFjOTU='
execute_query() [include/_generic/ForumManager.class.php, 27045]
track_hit() [forum.php, 146]
Elapsed: 2ms
----------------------------------------------------------------------
insert into v1_daily_statistics (dt, user_id, forum_id)
select '2023-09-12', NULL, 64
from v1_dual
where
not exists (select 1 from v1_daily_statistics where dt = '2023-09-12' and user_id is NULL and forum_id = 64);
execute_query() [include/_generic/ForumManager.class.php, 27150]
track_hit() [forum.php, 146]
Elapsed: 0ms
----------------------------------------------------------------------
update v1_daily_statistics set
hits_count = hits_count + 1
where
dt = '2023-09-12' and user_id is NULL and forum_id = 64;
execute_query() [include/_generic/ForumManager.class.php, 27160]
track_hit() [forum.php, 146]
Elapsed: 1ms
----------------------------------------------------------------------
select v1_user.id, v1_user.user_name, forum_id, topic_id, guest_name, v1_forum_hits.ip, user_agent, logout,
max(dt) last_time
from v1_forum_hits
left join v1_user on (v1_forum_hits.user_id = v1_user.id)
where dt >= '2023-09-12 14:40:53'
group by v1_user.id, v1_user.user_name, forum_id, topic_id, guest_name, v1_forum_hits.ip, user_agent, logout
order by max(dt) desc
execute_query() [include/_generic/ForumManager.class.php, 7478]
get_online_users() [forum.php, 152]
Elapsed: 0ms
----------------------------------------------------------------------
select new_dt from v1_cache_invalidation
execute_query() [include/_generic/NewChecker.class.php, 129]
calculate_new_messages() [include/_generic/ForumManager.class.php, 3624]
calculate_new_messages() [include/check_new_inc.php, 8]
require_once() [forum.php, 156]
Elapsed: 0ms
----------------------------------------------------------------------
Total execution time: 6189ms
----------------------------------------------------------------------
[root@dragon log]#
Вот сам запрос, который выполняется 6 секунд в данном случае 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21.
select
v1_topic.id, v1_topic.name, v1_topic.creation_date,
v1_topic_statistics.last_message_date,
v1_topic_statistics.post_count,
v1_topic_statistics.post_count_total,
v1_topic_statistics.hits_count,
v1_topic_statistics.bot_hits_count,
v1_topic.profiled_topic,
v1_topic.deleted, v1_topic.closed, v1_topic.pinned, v1_topic.publish_delay, has_pinned_post,
v1_forum.deleted forum_deleted,
v1_topic.user_id, v1_topic.author, v1_topic.read_marker, v1_user.user_name,
v1_user.last_visit_date, v1_user.logout,
forum_id, v1_forum.name forum_name, is_poll, v1_topic.no_guests
from v1_topic
inner join v1_topic_statistics force index (v1_topic_statistics_lmdate_idx) on (v1_topic.id = v1_topic_statistics.topic_id)
inner join v1_forum on (v1_topic.forum_id = v1_forum.id)
left join v1_user on (v1_topic.user_id = v1_user.id)
where v1_topic.forum_id = 64 and v1_topic.deleted + v1_forum.deleted = 0
and v1_topic.pinned + v1_topic.publish_delay = 0
order by v1_topic_statistics.last_message_date desc
limit 0, 38
Если убрать хинт 1.
force index (v1_topic_statistics_lmdate_idx)
то работает быстро на этом форуме, но на больших уже долго.
|