我在这里发起了一个查询,该查询对检索与连接不匹配的结果做了一些特别的事情(如this SO question所建议的那样)。
SELECT cf.f_id
FROM comments_following AS cf
INNER JOIN comments AS c ON cf.c_id = c.id
WHERE NOT EXISTS (
SELECT 1 FROM follows WHERE f_id = cf.f_id
)
关于如何加快速度的任何想法?它正在查看 30k-200k 行,并且似乎正在使用索引,但查询超时。
解释/描述信息:
1 PRIMARY c ALL PRIMARY NULL NULL NULL 39119
1 PRIMARY cf ref c_id, c_id_2 c_id 8 ...c.id 11 Using where; Using index
2 DEPENDENT SUBQUERY following index NULL PRIMARY 8 NULL 35612 Using where; Using index