V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
superbai
V2EX  ›  程序员

请教一个 mysql join 多张表性能分析问题

  •  
  •   superbai · Aug 3, 2017 · 1996 views
    This topic created in 3198 days ago, the information mentioned may be changed or developed.

    mysql 版本 5.1.X 有一条 sql 语句,join 了多张表,其中有一张主要是过滤数据的表是可 join 可不 join 的(因为数据从 mysql 取出来后用另外的代码碰巧也起到了相同的过滤作用)。用 explain 进行了分析,发现这张表命中了唯一索引,rows=1,是不是就说明不论是否 join 这张表,其实对于性能的影响都不大?

    附上 explain 的结果: *************************** 2. row *************************** id: 1 select_type: PRIMARY table: d type: eq_ref possible_keys: EID_UNQ key: EID_UNQ key_len: 98 ref: c.ac_id rows: 1 Extra: Using where; Using index

    1 replies    2017-08-04 14:54:28 +08:00
    as9567585
        1
    as9567585  
       Aug 4, 2017
    为什么感觉好大家都用 5.1,不应该是 56 更流行吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1170 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 23:08 · PVG 07:08 · LAX 16:08 · JFK 19:08
    ♥ Do have faith in what you're doing.