DB2 index and concurrency Analysis

Source: Internet
Author: User
Tags db2 connect db2 connect to


DB2 index and concurrency analysis before DB2 V9.7 or if the CC feature is not enabled for DB2 V9.7, if the query scans records that are being inserted or modified, the query will be suspended, until the session of the modification record is submitted or rolled back. [Huateng @ db2server ~] $ Db2 connect to dbtest Database Connection Information Database server = DB2/LINUX 9.7.0 SQL authorization ID = HUATENG Local database alias = DBTEST [huateng @ db2server ~] $ Db2 get db cfg | grep CUR_COMMIT Currently Committed www.2cto.com (CUR_COMMIT) = DISABLED: the current database version is 9.7. The Currently Committed feature is not enabled. Session 1 was modified as follows and was not submitted: db2 => select * from tID ----------- 1 2 3 4 5 6 7 8 8 record (s) selected. db2 => update t set id = 9 where id = 8 DB20000I The SQL command completed successfully. db2 => when Session 2 performs the following query, it will cause suspension: db2 => select * from t where id = 1 until Session 1 is submitted. Www.2cto.com if the T table ID has an index, the result will be different: session 1: db2 => select * from tID ----------- 1 2 3 4 5 6 7 8 8 record (s) selected. db2 => create index idx_t_01 on t (id) DB20000I The SQL command completed successfully. db2 => commitDB20000I The SQL command completed successfully. db2 => update t set id = 9 where id = 8DB20000I The SQL command completed successfully. db2 => Session 2: perform the following query to instantly complete db2 => select * from t where id = 1I D ----------- 1 1 record (s) selected. At this time, the query will locate the record with id = 1 through the index, without scanning the record with ID = 8, so it will not block. Author: TOMSYAN

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.