V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
coolair
V2EX  ›  问与答

数据库每次插入数据前都要搜索一遍该数据是否已经在数据库中,时间长了,数据库大了,这个过程就变得很慢,怎么破?

  •  
  •   coolair · Aug 23, 2014 via iPhone · 3246 views
    This topic created in 4267 days ago, the information mentioned may be changed or developed.
    3 replies    2014-08-23 20:03:04 +08:00
    amphineko
        1
    amphineko  
       Aug 23, 2014
    加Index和Unique, 或者把判断交给数据库
    canesten
        2
    canesten  
       Aug 23, 2014 via Android
    让数据库自己生成主键
    自己设计UUID
    分片
    ferock
        3
    ferock  
    PRO
       Aug 23, 2014
    Unique 就是用来干这事的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   932 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 21:19 · PVG 05:19 · LAX 14:19 · JFK 17:19
    ♥ Do have faith in what you're doing.