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

mysql 锁的问题

  •  
  •   Chaox · Dec 25, 2020 · 1430 views
    This topic created in 1952 days ago, the information mentioned may be changed or developed.

    源自 innodb 技术内幕的一句话,只有当实现本身增加开销时,行级锁才会增加开销,innodb 不存在锁升级,一个锁和多个锁的开销是一样的。 这里一个锁和多个锁的开销是一样的的意思是:我如果用了多个行锁和一个行锁的开销是一样?这是不是不太符合逻辑?

    2 replies    2020-12-27 19:01:04 +08:00
    lpts007
        1
    lpts007  
       Dec 25, 2020
    In the InnoDB transaction model, the goal is to combine the best properties of a multi-versioning database with traditional two-phase locking. InnoDB performs locking at the row level and runs queries as nonlocking consistent reads by default, in the style of Oracle. The lock information in InnoDB is stored space-efficiently so that lock escalation is not needed. Typically, several users are permitted to lock every row in InnoDB tables, or any random subset of the rows, without causing InnoDB memory exhaustion.


    ->The lock information in InnoDB is stored space-efficiently so that lock escalation is not needed.

    -> space-efficiently

    大致意思就是行锁开销为 0,n 个行锁开销为 0 * n = 0,这种意思吧。

    黑箱知识适度打开,打开多了容易碰见黑洞,耗尽精力也没啥用。很多中文资料看一看就算了,别纠结。
    Chaox
        2
    Chaox  
    OP
       Dec 27, 2020
    @lpts007 好的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   803 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:25 · PVG 04:25 · LAX 13:25 · JFK 16:25
    ♥ Do have faith in what you're doing.