sybase的锁定模式用于什么? [英] What is the locking schema of sybase used for?

查看:91
本文介绍了sybase的锁定模式用于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在使用Sybase,在创建表时,应该为其提供锁定模式。我知道其他DB可以选择DBMS锁定。现在,我对此有两个问题:

Now I am using Sybase, when I create table, I should give a locking schema for it. I know other DB can choose lock by DBMS. Now I have two questions for this:


  1. 当我给出用于将模式锁定到表的全页锁时,但是当我删除行或插入行时,我检查了锁,发现锁可以是行共享锁。否则,当我使用行锁来锁定架构时,它可能会选择表排除锁。那么锁定模式有什么用?

  1. When I give a all page lock for locking schema to a table, but when I delete rows or insert rows, I check the lock, I find the lock can be row share lock. Otherwise, when I use rows lock for locking schema, it may choose table exclude lock. So what are the locking schema use for?

行锁可以实现数据库tansaction隔离级别3。我知道在此级别您不能插入新的适合其他交易选择结果的行。我想知道DBMS是否只能使用行锁或页面锁来实现隔离级别3。

Can a row lock to implement DB tansaction isloation level 3. I know in this level you can't insert new row which fits for other transaction select results. I want to know can a DBMS only use row lock or page lock to imeplement the isoation level 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.

表锁定方案与服务器隔离级别没有直接关系。隔离级别可以在服务器范围内设置,也可以在每个事务中设置,并且只能影响请求进程获取的锁的类型。您可以在具有任何锁定方案的表上设置隔离级别3。在某些方面,隔离级别是一个逻辑控制,而锁定方案是一个物理控制。

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的锁定模式用于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆