Unlock instant, AI-driven research and patent intelligence for your innovation.

Database constraint relationship checking method and device

A technology that constrains relationships and checks methods, applied in the database field, can solve problems such as database performance impact, and achieve the effect of ensuring validity

Active Publication Date: 2022-07-12
BEIJING OCEANBASE TECH CO LTD
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

For example, for foreign key constraints, when a row of data records is added to a child table, a shared lock needs to be added to the data records corresponding to the parent table and even the entire table to prevent the parent table from being modified or deleted, thereby ensuring the validity of the constraint relationship check. Locking usually causes the performance of the database to be affected

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Database constraint relationship checking method and device
  • Database constraint relationship checking method and device
  • Database constraint relationship checking method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0031] The solution provided in this specification will be described below with reference to the accompanying drawings.

[0032] As mentioned above, in the conventional technology, when a constraint relationship is checked against a database, it is usually necessary to lock related data records to ensure the validity of the constraint relationship detection, which will affect the performance of the database.

[0033] In order not to affect the performance of the database, the inventor of the present application proposes to add a corresponding transaction version number to the data records in the database. Specifically, when a transaction is opened to add or modify a row of data records, the corresponding transaction version number is determined for the newly added data record or the modified data record, and the transaction version number is added therein. The new (or modified) data records after adding the transaction version number are then stored in the database. The size ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

Embodiments of this specification provide a method and device for checking a constraint relationship in a database. In the method for checking a constraint relationship, a DML operation of the first transaction is performed for a target data table in the database, and each data stored in each data table in the database is executed. Records have transaction version numbers. Enter the commit phase, and in the commit phase, determine the corresponding current transaction version number for the target data record after the DML operation. Based on the current transaction version number, the latest relevant data records visible to the first transaction are read from the target data table or its associated data table. The target data record and the field value corresponding to the target field of each related data record have a mutual restriction relationship. Based on each related data record, a constraint relationship check is performed on the target field value of the target data record corresponding to the target field. If the constraint check is passed, the first transaction is committed, otherwise it is rolled back.

Description

technical field [0001] One or more embodiments of this specification relate to the field of databases, and in particular, to a method and apparatus for checking a constraint relationship of a database. Background technique [0002] General relational databases provide a series of constraint definitions to limit the integrity of data in the database. In order to ensure that the constraints are not destroyed, after the addition, deletion and modification operation is performed on the database, it is usually necessary to check the constraint relationship of the data record after the addition, deletion and modification operation. [0003] In the traditional technology, when the constraint relationship is checked, the related data records are usually locked. For example, foreign key constraints, when adding a row of data records to a child table, it is necessary to add a shared lock to the data records corresponding to the parent table and even the entire table to prevent the pa...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F16/21G06F16/22G06F16/28
CPCG06F16/219G06F16/2282G06F16/284
Inventor 阳振坤韩富晟魏宇臣孔繁宇
Owner BEIJING OCEANBASE TECH CO LTD