• 请不要在回答技术问题时复制粘贴 AI 生成的内容
thomaswang
V2EX  ›  程序员

mysql 索引问题

  •  
  •   thomaswang · Aug 11, 2017 · 3174 views
    This topic created in 3224 days ago, the information mentioned may be changed or developed.
    msyql B+索引问题,比如:name 字段加了索引, 当插入一条数据的时候,是不是要对该条数据的 name 值进行 hash,把值转换成整数,然后插入到 B+树里面,如果是这样的,那么这个 hash 算法是什么呢
    11 replies    2017-08-12 12:38:42 +08:00
    iEverX
        1
    iEverX  
       Aug 12, 2017 via Android
    不做 hash 吧,否则怎么有序
    thomaswang
        2
    thomaswang  
    OP
       Aug 12, 2017 via iPhone
    @iEverX 不 hash 怎么把张三李四排序呢
    tb4649120073rs
        3
    tb4649120073rs  
       Aug 12, 2017
    @thomaswang 按字符串比较大小啊...
    1010011010
        4
    1010011010  
       Aug 12, 2017
    gbk 排序?
    limhiaoing
        5
    limhiaoing  
       Aug 12, 2017 via iPhone
    @thomaswang
    不 hash 怎么就不能对字符串排序了?
    SoloCompany
        6
    SoloCompany  
       Aug 12, 2017 via iPad
    hash 和 b+,楼主是走串场了吧
    thomaswang
        7
    thomaswang  
    OP
       Aug 12, 2017
    @limhiaoing 哦,你确定 mysql 里面是按字符串排序,对吗
    thomaswang
        8
    thomaswang  
    OP
       Aug 12, 2017
    @SoloCompany 我是不懂,mysql 是直接拿字符串来比较大小,然后插入到 B+树的吗
    thomaswang
        9
    thomaswang  
    OP
       Aug 12, 2017
    @tb4649120073rs 你确定 mysql 是拿字符串比较的,对吗
    SoloCompany
        10
    SoloCompany  
       Aug 12, 2017 via iPad
    @thomaswang 不是字符串顺序的话,那 order by 怎么办,难道是 order by hash ?另外还有个概念叫 collation 你先了解一下
    thomaswang
        11
    thomaswang  
    OP
       Aug 12, 2017
    @SoloCompany 哦,我先看看,多谢,有啥好点的书,可以推荐不
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1164 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 17:53 · PVG 01:53 · LAX 10:53 · JFK 13:53
    ♥ Do have faith in what you're doing.