我有这个 MySQL 查询:
EXPLAIN EXTENDED
SELECT img.id as iid,img.*,users.*,img.ave_rate as arate,img.count_rate as cn
FROM images AS img
LEFT OUTER JOIN users on img.uid=users.id
WHERE img.id NOT IN (SELECT rates.imageid from rates WHERE rates.ip=1854604622)
GROUP BY iid
ORDER BY
iid DESC
LIMIT 30
它的输出是这样说的:
1 PRIMARY img index NULL PRIMARY 4 NULL 30 580 Using where
1 PRIMARY users eq_ref PRIMARY PRIMARY 4 twtgirls3.img.uid 1 100
2 DEPENDENT SUBQUERY rates ref imageid,ip ip 5 const 4 100 Using where
正如您在第一行中看到的那样,它使用 PRIMARY 键作为索引,但在额外的列中我们有“Using Where”,这是什么意思?这是否意味着未使用密钥?我们在第三排也有同样的情况......
最后,您如何看待这个查询?优化了吗?