V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
awanganddong
V2EX  ›  MySQL

mysql8 版本和 mysql5.6 版本遇到查询问题

  •  
  •   awanganddong · Apr 24, 2020 · 3602 views
    This topic created in 2194 days ago, the information mentioned may be changed or developed.

    //在 mysql5.6 版本可以命中 ad_data_id 这个索引

    explain SELECT * from ssp_ad_data left join ssp_ad_statistics on ssp_ad_data.id=ssp_ad_statistics.ad_data_id;

    //在 mysql8.0 不能命中索引

    提示

    Using where; Using join buffer (Block Nested Loop)

    3 replies    2020-04-25 16:48:38 +08:00
    awanganddong
        1
    awanganddong  
    OP
       Apr 25, 2020
    问了下公司技术大佬
    然后确定是无符号的问题

    在 mysql5.6 和 mysql8.0 对符号有差异

    在 mysq8 设置符号后可以命中索引
    CStarter
        2
    CStarter  
       Apr 25, 2020
    看到 Block Nested Loop 这个,我感觉也有可能是字符集的问题?
    awanganddong
        3
    awanganddong  
    OP
       Apr 25, 2020
    @CStarter 现在通过对 mysql8.0 字段变为无符号就可以命中索引,但是对为什么这样,我现在还没有查找相关的说明
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1044 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:44 · PVG 06:44 · LAX 15:44 · JFK 18:44
    ♥ Do have faith in what you're doing.