MyBB Community Forums

Full Version: Adding index to thanks tables / slow query problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it advisable to add some sort of index to these tables? I am getting repeated slow queries in the slow query log, such as this, about once per minute or so.


# Time: 150915 21:08:48
# User@Host: mybb @ localhost []
# Query_time: 3.384218  Lock_time: 0.000054 Rows_sent: 38  Rows_examined: 1094627
SET timestamp=1442365728;
SELECT pid FROM mybb_posts WHERE pid IN (
                                SELECT tyl.pid
                                FROM mybb_g33k_thankyoulike_thankyoulike tyl
                                WHERE tyl.puid = 31010) AND fid NOT IN ('18','40','43','11','32','33','42','25','41','44') ORDER BY dateline DESC LIMIT 1000;

Anyone else have a recommendation to reduce the query time?
Moved to plugin support.

If there's not currently an index on the table, I'd definitely advise adding one.