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

求解一道面试题

  •  
  •   mortonnex · Apr 12, 2017 via iPhone · 1999 views
    This topic created in 3410 days ago, the information mentioned may be changed or developed.
    数据库加行锁,是加到哪里的?
    3 replies    2017-04-12 16:00:07 +08:00
    torbrowserbridge
        1
    torbrowserbridge  
       Apr 12, 2017
    google 来的: InnoDB 行锁是通过给索引上的索引项加锁来实现的
    ihuotui
        2
    ihuotui  
       Apr 12, 2017
    答案不唯一,看有没有主键,有没有索引,查询条件,锁的位置也不一样。
    Hozzz
        3
    Hozzz  
       Apr 12, 2017
    首先是库锁、表锁和行锁,如果行上有索引,还会在索引上加锁;访问方式不同,还分为共享锁和排它锁_(:з」∠)_
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5262 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 08:48 · PVG 16:48 · LAX 01:48 · JFK 04:48
    ♥ Do have faith in what you're doing.