Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1892268
  • 博文数量: 389
  • 博客积分: 7877
  • 博客等级: 少将
  • 技术积分: 4521
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-10 14:02
文章分类

全部博文(389)

文章存档

2024年(1)

2022年(1)

2021年(1)

2020年(1)

2019年(1)

2018年(3)

2017年(6)

2016年(4)

2015年(8)

2014年(15)

2013年(31)

2012年(19)

2011年(47)

2010年(33)

2009年(105)

2008年(109)

2007年(4)

分类:

2009-08-31 11:35:09

这里记录下来所想到的问题:
1. locklist的大小需要重新调整了,因为在32位环境下和64位环境下一个锁所占用的内存资源大小不一样,所以同样的locklist大小在32位下可以锁500万行的数据,但是在64位下可能只有300万这样;

DB2 Version 9.7 for Linux, UNIX, and Windows

locklist - Maximum storage for lock list configuration parameter



On all platforms, each lock requires 128 or 256 bytes of the lock list, depending on whether other locks are held on the object:
  • 256 bytes are required to hold a lock on an object that has no other locks held on it
  • 128 bytes are required to record a lock on an object that has an existing lock held on it.
When the percentage of the lock list used by one application reaches maxlocks, the database manager will perform lock escalation, from row to table, for the locks held by the application. Start of change This calculation is an approximation, assuming shared locks only. The percentage of the lock list used is calculated by multiplying the number of locks held by the application by the value required to hold a lock on an object that has other locks held on it. End of change Although the escalation process itself does not take much time, locking entire tables (versus individual rows) decreases concurrency, and overall database performance might decrease for subsequent accesses against the affected tables. Suggestions of how to control the size of the lock list are:
  • Perform frequent COMMITs to release locks.
  • When performing many updates, lock the entire table before updating (using the SQL LOCK TABLE statement). This will use only one lock, keeps others from interfering with the updates, but does reduce concurrency of the data.

    You can also use the LOCKSIZE option of the ALTER TABLE statement to control how locking is done for a specific table.

    Use of the Repeatable Read isolation level might result in an automatic table lock.

  • Use the Cursor Stability isolation level when possible to decrease the number of share locks held. If application integrity requirements are not compromised use Uncommitted Read instead of Cursor Stability to further decrease the amount of locking.
  • Set locklist to AUTOMATIC. The lock list will increase synchronously to avoid lock escalation or a lock list full situation.

Once the lock list is full, performance can degrade since lock escalation will generate more table locks and fewer row locks, thus reducing concurrency on shared objects in the database. Additionally there might be more deadlocks between applications (since they are all waiting on a limited number of table locks), which will result in transactions being rolled back. Your application will receive an SQLCODE of -912 when the maximum number of lock requests has been reached for the database.


阅读(1602) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~