azev
V2EX  ›  问与答

这样一个 user 表是该怎么做索引呢

  •  
  •   azev · Sep 22, 2020 · 986 views
    This topic created in 2077 days ago, the information mentioned may be changed or developed.

    假设这样一个表
    id,name,password,address

    查询时常使用 name 和 address 再考虑登录操作
    做多列索引还是单列索引呢

    2 replies    2020-09-22 13:17:17 +08:00
    nl101531
        1
    nl101531  
       Sep 22, 2020
    name 唯一索引
    address 前缀索引
    nomansky
        2
    nomansky  
       Sep 22, 2020
    id 主键索引
    name 和 address 一起做联合索引,name 可以全部索引,address 前缀索引
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   954 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:46 · PVG 02:46 · LAX 11:46 · JFK 14:46
    ♥ Do have faith in what you're doing.