sybase的locking schema是干什么用的?
What is the locking schema of sybase used for?
现在我正在使用 Sybase,当我创建 table 时,我应该为它提供一个锁定模式。我知道其他数据库可以通过 DBMS 选择锁定。现在我有两个问题:
当我给table锁定架构的所有页锁时,但是当我删除行或插入行时,我检查锁,我发现锁可以是行共享锁。否则,当我使用行锁来锁定架构时,它可能会选择 table 排除锁。那么锁定模式有什么用呢?
可以使用行锁来实现 DB 事务隔离级别 3。我知道在这个级别你不能插入适合其他事务 select 结果的新行。我想知道 DBMS 是否可以仅使用行锁或页锁来实现隔离级别 3。
The locking scheme can be set a couple different ways. A default can be set at the server level, and all tables created will use the default. If the default is changed, the tables will not convert to the new locking scheme automatically, as far as I know.
You typically choose the locking schema based on your needs for the system. Each level of locking granularity has a performance cost, and a concurrency cost, so acquiring a table lock is cheaper than a page level lock, but limits some of the concurrent transactions on the locked table.
The table locking schemes are not directly related to the server isolation level. The isolation level can be set server wide, or per transaction, and may only affect the type of lock acquired by the requesting process. You can have isolation level 3 on tables with any locking scheme. In some ways the isolation level is a logical control, and the locking scheme is a physical control.
I really suggest you read the documentation, as it covers so much more than I can cover here.
现在我正在使用 Sybase,当我创建 table 时,我应该为它提供一个锁定模式。我知道其他数据库可以通过 DBMS 选择锁定。现在我有两个问题:
当我给table锁定架构的所有页锁时,但是当我删除行或插入行时,我检查锁,我发现锁可以是行共享锁。否则,当我使用行锁来锁定架构时,它可能会选择 table 排除锁。那么锁定模式有什么用呢?
可以使用行锁来实现 DB 事务隔离级别 3。我知道在这个级别你不能插入适合其他事务 select 结果的新行。我想知道 DBMS 是否可以仅使用行锁或页锁来实现隔离级别 3。
The locking scheme can be set a couple different ways. A default can be set at the server level, and all tables created will use the default. If the default is changed, the tables will not convert to the new locking scheme automatically, as far as I know.
You typically choose the locking schema based on your needs for the system. Each level of locking granularity has a performance cost, and a concurrency cost, so acquiring a table lock is cheaper than a page level lock, but limits some of the concurrent transactions on the locked table.
The table locking schemes are not directly related to the server isolation level. The isolation level can be set server wide, or per transaction, and may only affect the type of lock acquired by the requesting process. You can have isolation level 3 on tables with any locking scheme. In some ways the isolation level is a logical control, and the locking scheme is a physical control.
I really suggest you read the documentation, as it covers so much more than I can cover here.