codersclub/forum — pull request #164 by negram (2014-09-06 21:23:14+00:00)
Title: Use Sphinx to open user's profile page. It should extremely speed of ope...

Использование Сфинкса для отображения активности пользователя в разделах. Избавляемся от одного доооолгого запроса в slowlog, потипу:
SET timestamp=1410032934;
SELECT DISTINCT(p.forum_id), f.name, COUNT(p.author_id) AS f_posts
FROM ibf_posts p, ibf_forums f
WHERE p.forum_id IN (0,9,4,2,46,165,6,7,8,52,11,92,12,90,91,13,14,15,17,18,19,20,25,26,27,28,217,29,241,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,47,48,49,50,103,59,60,61,62,63,64,65,66,67
,68,69,70,72,74,75,73,78,79,96,82,24,89,86,84,83,87,88,99,97,98,101,151,102,105,108,104,109,107,110,111,112,119,115,114,116,233,117,128,118,121,122,126,124,129,125,127,130,131,132,134,136,155,135,137,138,139,140
,141,142,143,144,145,146,147,156,148,153,154,157,159,161,158,160,162,164,163,166,168,167,169,173,172,170,171,174,175,176,177,178,179,180,181,182,183,184,185,186,189,190,76,191,187,188,192,106,77,150,152,149,113,
10,3,81,54,1,21,5,56,22,23,42,53,57,58,16,195,194,193,202,196,197,198,199,200,201,205,204,207,206,208,209,214,215,225,222,216,229,230,218,219,220,221,226,223,224,227,234,232,235,236,237,239,240,242)
AND p.author_id='1094'
AND p.forum_id=f.id
GROUP BY p.forum_id
ORDER BY f_posts DESC;