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

mysql 索引问题

  •  
  •   thomaswang · Aug 11, 2017 · 3495 views
    This topic created in 3387 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
    iEverX
    Aug 12, 2017 via Android
    1
    不做 hash 吧,否则怎么有序
    thomaswang
    thomaswang
    OP
    Aug 12, 2017 via iPhone
    2
    @iEverX 不 hash 怎么把张三李四排序呢
    tb4649120073rs
    tb4649120073rs
    Aug 12, 2017
    3
    @thomaswang 按字符串比较大小啊...
    1010011010
    1010011010
    Aug 12, 2017
    4
    gbk 排序?
    limhiaoing
    limhiaoing
    Aug 12, 2017 via iPhone
    5
    @thomaswang
    不 hash 怎么就不能对字符串排序了?
    SoloCompany
    SoloCompany
    Aug 12, 2017 via iPad
    6
    hash 和 b+,楼主是走串场了吧
    thomaswang
    thomaswang
    OP
    Aug 12, 2017
    7
    @limhiaoing 哦,你确定 mysql 里面是按字符串排序,对吗
    thomaswang
    thomaswang
    OP
    Aug 12, 2017
    8
    @SoloCompany 我是不懂,mysql 是直接拿字符串来比较大小,然后插入到 B+树的吗
    thomaswang
    thomaswang
    OP
    Aug 12, 2017
    9
    @tb4649120073rs 你确定 mysql 是拿字符串比较的,对吗
    SoloCompany
    SoloCompany
    Aug 12, 2017 via iPad
    10
    @thomaswang 不是字符串顺序的话,那 order by 怎么办,难道是 order by hash ?另外还有个概念叫 collation 你先了解一下
    thomaswang
    thomaswang
    OP
    Aug 12, 2017
    11
    @SoloCompany 哦,我先看看,多谢,有啥好点的书,可以推荐不
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2067 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 13:25 · PVG 21:25 · LAX 05:25 · JFK 08:25
    ♥ Do have faith in what you're doing.