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

求解一道面试题

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