Sybase table lock, page lock, row lock

Source: Internet
Author: User
Tags sybase
 Alter table xsjl lock datapages  Alter table xsjl lock datarows  Alter table xsjl lock allpages 1. allpages lock locks the queried tables and index pages, that is, table lock.
2. Page lock(Data lock)   Locks the page where the query result is located, and does not lock the index.
3. Row lock(Row lock)    Lock a row of data
It seems that the memory occupied by a lock is 120 bytes! The lock is only a protection mechanism and does not affect data storage!   Row-level locks should be fully considered for applications with high concurrency, which is crucial for improving concurrency performance! Of course, there are two advantages and disadvantages in transactions. The use of Row-level locks also brings about some drawbacks. For example, the more locks are used, the more memory occupied, frequent data deletion and insertion operations on tables with row-level locks will result in a large number of database fragments generated over time, and the database performance will decrease. this requires regular reorg operations, but this operation is time-consuming and affects the business!
1.Reorg reclaim_space recycles unused space on pages generated by deletion and row shortening update operations. Reorg reclaim_space tablename: reclaim unused space on the table  Reorg rebuild undo row transfer and reclaim space, rewrite all rows so as to be consistent with the clustered index of the table, write rows to the data page so as to be consistent with the changes made to the space management settings through sp_chgattribute, delete and recreate all indexes of a table
2. reorg rebuild tablename: reclaim the tablespace and recreate all indexes.  Note: reorg is similar to DBCC and requires a certain amount of disk and other resources. Do not execute reorg when the server is busy.

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: 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.