0

向查询添加附加联接时出现问题。

此查询需要将近一分钟才能运行:

SELECT * FROM jos_mls AS mls
        INNER JOIN jos_activeagents AS active ON mls.MSTLISTBRD = active.AGENTUID
        INNER JOIN jos_agents AS agents ON active.AGENTUID = agents.AGTBRDIDMM
        INNER JOIN jos_clstmp AS cl ON mls.MSTMLSNO = cl.MSTMLSNO
    WHERE mls.MSTACTSTA != 'Inactive'
    AND mls.MSTLISTDT >= SUBDATE(CURDATE(), INTERVAL 1 DAY)

如果我省略 line INNER JOIN jos_clstmp AS cl ON mls.MSTMLSNO = cl.MSTMLSNO,则只需不到一秒钟。

jos_clstmp 表只有两列。一个键和一个时间戳。我不认为它会给这个过程增加那么多,但它正在扼杀它。

4

1 回答 1

1
INNER JOIN jos_clstmp AS cl ON mls.MSTMLSNO = cl.MSTMLSNO

做两列

mls.MSTMLSNO and cl.MSTMLSNO

有一个键/索引?

于 2013-05-23T19:49:16.147 回答