我有两张桌子->
用户
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY username VARCHAR(200) NOT NULL
ping
ping_id INT UNSIGNED NOT NULL AUTO_INCREMENT PPRIMARY KEY disqus_id VARCHAR(32) NOT NULL user_id INT UNSIGNED NOT NULL INDEX combo1(disqus_id,user_id)
我运行这个查询->
EXPLAIN SELECT pings.*, username
FROM pings
INNER JOIN users USING(user_id)
WHERE pings.disqus_id = 'post_168' AND user_id = '1'
ORDER BY pings.ping_id DESC LIMIT 2
Extra
pimgs下的列表示Using where; Using temporary; Using filesort
,users 下的列表示Using where; Using join buffer
。
我运行这个查询->
EXPLAIN SELECT pings.*, username
FROM pings
LEFT JOIN users USING(user_id)
WHERE pings.disqus_id = 'post_168' AND user_id = '1'
ORDER BY pings.ping_id DESC LIMIT 2
Extra
pimgs下的列表示Using where
,而 users 下的列是空的。
怎么了?