我有表players
、players_to_teams
和accounts
。 对和players_to_teams
有一个 FK 。 有一个并且有一个。和都被索引。players
accounts
players
FirstName
accounts
Name
FirstName
Name
跑步
SELECT players_to_teams.id
FROM players_to_teams
INNER JOIN players
ON players.id = players_to_teams.player_id
ORDER BY players.FirstName
在 0.004 秒内执行。
SELECT players_to_teams.id
FROM players_to_teams
INNER JOIN accounts
ON accounts.id = players_to_teams.account_id
ORDER BY accounts.Name
执行时间超过 7 秒。
有 30,000 个帐户记录和 250,000 个玩家记录。
EXPLAIN
可以在这里找到:https ://gist.github.com/2368906
这些查询不应该在相似的时间空间中执行吗?