Index tuple processing method and device of database system and computer equipment

By determining whether the transaction associated with the index tuple has been terminated in the database system, freezing operations are avoided, solving the problem of excessive resource consumption during disk sweeping operations in traditional database systems, and achieving more stable operation.

CN121542270APending Publication Date: 2026-02-17CHINA TELECOM CLOUD TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610063856.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-19
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

The garbage collection mechanism of index tuples in traditional database systems requires a large number of disk sweep operations, resulting in high computational resource consumption and affecting system stability.

Method used

By obtaining the modified transaction identifier in the target index page and the oldest global transaction identifier in the database system, it can be determined whether the transaction associated with the index tuple has been terminated, thus avoiding freeze operations and reducing disk sweep operations.

Benefits of technology

It improves the operational stability of the database system, reduces periodic fluctuations, and saves computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542270A_ABST
    Figure CN121542270A_ABST
Patent Text Reader

Abstract

The invention relates to an index tuple processing method and device of a database system and computer equipment. The method comprises the steps of obtaining a to-be-judged index tuple in a target index page, and reading a modified transaction identifier added in the to-be-judged index tuple; the modified transaction identifier is used for representing the transaction identifier corresponding to the inserted or deleted index tuple; acquiring a global oldest transaction identifier maintained in a rollback section of the database system; the global oldest transaction identifier is used for representing the maximum transaction identifier of all terminated transactions in the database system; and under the condition that the modified transaction identifier of the to-be-judged index tuple is smaller than the oldest transaction identifier, judging that the transaction associated with the to-be-judged index tuple is a terminated transaction. By adopting the method, the operation stability of the database system can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud database, and particularly relates to an index tuple processing method and device of a database system, computer equipment, a computer readable storage medium and a computer program product. BACKGROUND

[0002] In a database index, the garbage collection mechanism of an index tuple refers to a mechanism for identifying, marking, cleaning and recycling invalid index tuples in an index page.

[0003] However, the conventional technology often needs to determine whether an index tuple is valid according to version information of data corresponding to the index tuple; this makes the garbage collection mechanism of the index tuple in the conventional technology often need to perform a large number of disk scanning operations, however, the disk scanning operation often occupies a large amount of computing resources, which is easy to cause periodic fluctuations of the database system, and seriously affects the running stability of the database system.

[0004] Therefore, there is a problem of low running stability of the database system in the conventional technology. SUMMARY

[0005] Therefore, it is necessary to provide an index tuple processing method and device of a database system, computer equipment, a computer readable storage medium and a computer program product capable of improving the running stability of the database system in view of the above technical problems.

[0006] In a first aspect, the present application provides an index tuple processing method of a database system, the method comprising:

[0007] obtaining an index tuple to be determined in a target index page, and reading a modified transaction identifier added in the index tuple to be determined; the modified transaction identifier is used to represent a transaction identifier of inserting or deleting the index tuple;

[0008] obtaining a global oldest transaction identifier maintained in a rollback segment of the database system; the global oldest transaction identifier is used to represent a maximum transaction identifier of all terminated transactions in the database system;

[0009] in a case where the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, determining that a transaction associated with the index tuple to be determined is a terminated transaction.

[0010] In one of the embodiments, the method further comprises:

[0011] locating an index tuple to be processed indicated by a rollback command, and reading a rollback pointer added in the index tuple to be processed; the rollback pointer is used to represent a position of a rollback record corresponding to the index tuple to be processed in a rollback log;

[0012] reading a rollback record corresponding to the rollback pointer in the rollback log, and parsing a rollback index tuple from the rollback record, and obtaining index key information of the index tuple to be processed through the rollback index tuple;

[0013] querying a target index tuple corresponding to the index key information, and performing a rollback operation on the target index tuple.

[0014] In one of the embodiments, the method further comprises:

[0015] reading a modified transaction identifier added in the index tuple to be processed; the modified transaction identifier is used to represent an inserted or deleted transaction identifier corresponding to the index tuple;

[0016] if the modified transaction identifier of the index tuple to be processed is greater than or equal to the oldest transaction identifier, performing the step of reading the rollback pointer added in the index tuple to be processed.

[0017] In one of the embodiments, the querying a target index tuple corresponding to the index key information comprises:

[0018] if the index tuple to be processed has been split, locating the target index tuple in a split index page through the index key information;

[0019] if the index tuple to be processed has not been split, locating the target index tuple in an original index page through the index key information.

[0020] In one of the embodiments, the method further comprises:

[0021] reading a command identifier added in the rollback index tuple;

[0022] if the command identifier in the rollback index tuple is less than the command identifier of the rollback command, performing the step of querying a target index tuple corresponding to the index key information, and performing a rollback operation on the target index tuple.

[0023] In one of the embodiments, the terminated transaction comprises at least one of a committed transaction or a rolled back transaction.

[0024] In a second aspect, the application further provides an index tuple processing apparatus of a database system, comprising:

[0025] The reading module is used to obtain the index tuple to be judged in the target index page and read the modified transaction identifier added to the index tuple to be judged; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple.

[0026] The acquisition module is used to acquire the globally oldest transaction identifier maintained in the rollback segment of the database system; the globally oldest transaction identifier is used to represent the largest transaction identifier of all terminated transactions in the database system.

[0027] The determination module is used to determine that the transaction associated with the index tuple to be determined is a terminated transaction if the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier.

[0028] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0029] Obtain the index tuple to be judged in the target index page, and read the modified transaction identifier added to the index tuple to be judged; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple;

[0030] Obtain the oldest global transaction identifier maintained in the rollback segment of the database system; the oldest global transaction identifier is used to characterize the largest transaction identifier of all terminated transactions in the database system;

[0031] If the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, the transaction associated with the index tuple to be determined is determined to be a terminated transaction.

[0032] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0033] Obtain the index tuple to be judged in the target index page, and read the modified transaction identifier added to the index tuple to be judged; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple;

[0034] Obtain the oldest global transaction identifier maintained in the rollback segment of the database system; the oldest global transaction identifier is used to characterize the largest transaction identifier of all terminated transactions in the database system;

[0035] If the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, the transaction associated with the index tuple to be determined is determined to be a terminated transaction.

[0036] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0037] Obtain the index tuple to be judged in the target index page, and read the modified transaction identifier added to the index tuple to be judged; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple;

[0038] Obtain the oldest global transaction identifier maintained in the rollback segment of the database system; the oldest global transaction identifier is used to characterize the largest transaction identifier of all terminated transactions in the database system;

[0039] If the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, the transaction associated with the index tuple to be determined is determined to be a terminated transaction.

[0040] The aforementioned database system's index tuple processing method, apparatus, computer device, computer-readable storage medium, and computer program product obtain the index tuple to be determined from the target index page and read the modified transaction identifier added to the index tuple to be determined. The modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple. The system obtains the globally oldest transaction identifier maintained in the rollback segment of the database system, which represents the largest transaction identifier of all terminated transactions in the database system. If the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, the transaction associated with the index tuple to be determined is determined to be a terminated transaction. This means that the transaction to which the index tuple belongs has been committed or rolled back, and no freezing operation is required. By utilizing the rollback segment storage engine to record the globally oldest transaction identifier and comparing the size relationship between the globally oldest transaction identifier and the modified transaction identifier in the index tuple, the system can effectively determine whether the index tuple to be determined is in a valid state without needing to utilize the version information of the data corresponding to the index tuple to be determined. This reduces the performance impact of index freezing operations and avoids the need for index-only scans. The fact that a table lookup is still required during a scan effectively reduces the number of disk scan operations, thereby avoiding excessive disk scan operations that consume a lot of computing resources, reducing the periodic fluctuations of the database system, and achieving the beneficial effect of improving the operational stability of the database system. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 This is an application environment diagram of an index tuple processing method for a database system in one embodiment.

[0043] Figure 2 This is a flowchart illustrating an index tuple processing method for a database system in one embodiment.

[0044] Figure 3 This is a schematic diagram of the data structure of an index tuple in one embodiment;

[0045] Figure 4 This is a schematic diagram of the data structure of a rollback index tuple in one embodiment;

[0046] Figure 5 This is a schematic diagram illustrating an index tuple processing method for a database system in one embodiment.

[0047] Figure 6 This is a flowchart illustrating the index tuple processing method of a database system in another embodiment;

[0048] Figure 7 This is a block diagram of the index tuple processing device of a database system in one embodiment;

[0049] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0051] The multi-transaction identifier mapping data processing method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with database system 104 via a network. Terminal 102 can upload data to database system 104.

[0052] In practical applications, the database system 104 can obtain the index tuple to be determined in the target index page and read the modified transaction identifier added to the index tuple to be determined; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple.

[0053] Database system 104 can obtain the global oldest transaction identifier maintained in the rollback segment of the database system; the global oldest transaction identifier is used to characterize the largest transaction identifier of all terminated transactions in the database system;

[0054] Database system 104 can determine that the transaction associated with the index tuple to be determined is a terminated transaction if the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier.

[0055] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle systems, and projection devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. The database system 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0056] It should be noted that the database system in this application has a built-in global transaction counter. Each time a transaction is started, the database system can assign a unique ID, or transaction identifier, to that transaction through the global transaction counter. The transaction identifier can increment sequentially according to the order in which the transactions were created. In practical applications, this transaction identifier (transaction ID) can be 64 bits. In other words, the larger the transaction identifier, the closer its creation time is to the current time, and the transaction identifier does not have a rollback issue.

[0057] In one exemplary embodiment, such as Figure 2 As shown, a method for processing index tuples in a database system is provided, which can be applied to... Figure 1 Taking the database system in the example, the explanation includes the following steps S202 to S206. Wherein:

[0058] Step S202: Obtain the index tuple to be judged in the target index page, and read the modified transaction identifier added to the index tuple to be judged.

[0059] The target index page can refer to an index page that includes the index tuple to be determined.

[0060] The modified transaction identifier (modified_xid) is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple. In practice, the modified transaction identifier can be 64 bits.

[0061] In practice, the database system can write the transaction identifier of the transaction corresponding to the insertion or deletion of the index tuple as the modified transaction identifier (modified_xid) into the index tuple. For ease of understanding by those skilled in the art, Figure 3 A diagram illustrating the data structure of an index tuple is provided. For example... Figure 3 As shown, the index tuple includes a block number field (block), an offset field (offset), an index key field (key), a modified transaction identifier field (modified_xid), and an undo pointer field (undo pointer).

[0062] After obtaining the index tuple to be determined in the target index page, the database system can read the modified transaction identifier (modified_xid) added to the index tuple to be determined.

[0063] Step S204: Obtain the globally oldest transaction identifier maintained in the rollback segment of the database system.

[0064] Among them, the global oldest transaction identifier (globalfronzexid) is used to represent the largest transaction identifier among all terminated transactions in the database system.

[0065] In practical applications, the globally oldest transaction identifier can also represent the smallest transaction identifier among all active transactions in the database system. Furthermore, the globally oldest transaction identifier can also be named the oldest transaction identifier.

[0066] In practice, the database system can also obtain the global oldest transaction identifier (globalfronzexid) maintained in the rollback segment of the database system.

[0067] Step S206: If the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, the transaction associated with the index tuple to be determined is determined to be a terminated transaction.

[0068] In practice, after obtaining the modified transaction identifier (modified_xid) and the global oldest transaction identifier (globalfronzexid) of the rollback segment from the index tuple, the database system can compare the modified transaction identifier (modified_xid) with the global oldest transaction identifier (globalfronzexid). If the modified transaction identifier (modified_xid) is less than the global oldest transaction identifier (globalfronzexid), the database system determines that the transaction associated with the index tuple to be judged is a terminated transaction.

[0069] Optionally, a terminated transaction includes at least one of a committed transaction or a rolled-back transaction.

[0070] Specifically, if the transaction associated with the index tuple in the database system has been committed or rolled back, the database system does not need to perform a freeze operation or check the clog (control command log), and therefore no longer relies on VACUUM. VACUUM refers to garbage collection operations used to clean up "dead tuples" that are no longer needed by any transactions, thereby freeing up and reusing storage space, updating database statistics, and truncating log files that will no longer be accessed.

[0071] In the index tuple processing method of the aforementioned database system, the method obtains the index tuple to be judged from the target index page and reads the modified transaction identifier added to the index tuple to be judged. The modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple. The method also obtains the globally oldest transaction identifier maintained in the rollback segment of the database system, which represents the largest transaction identifier of all terminated transactions in the database system. If the modified transaction identifier of the index tuple to be judged is less than the oldest transaction identifier, the transaction associated with the index tuple to be judged is determined to be a terminated transaction. This means that the transaction to which the index tuple belongs has been committed or rolled back, and no freezing operation is required. By utilizing the rollback segment storage engine to record the globally oldest transaction identifier and comparing the size relationship between the globally oldest transaction identifier and the modified transaction identifier in the index tuple, the method can effectively eliminate the need to utilize the version information of the data corresponding to the index tuple to be judged. This allows for the determination of whether the index tuple to be judged is in a valid state, reducing the performance impact of index freezing operations and avoiding the need to perform index-only scans. The fact that a table lookup is still required during a scan effectively reduces the number of disk scan operations, thereby avoiding excessive disk scan operations that consume a lot of computing resources, reducing the periodic fluctuations of the database system, and achieving the beneficial effect of improving the operational stability of the database system.

[0072] In an exemplary embodiment, the method further includes: locating the index tuple to be processed indicated by the rollback command, reading the rollback pointer added to the index tuple to be processed; reading the rollback record corresponding to the rollback pointer in the rollback log, parsing the rollback index tuple from the rollback record, obtaining the index key information of the index tuple to be processed through the rollback index tuple; querying the target index tuple corresponding to the index key information, and performing a rollback operation on the target index tuple.

[0073] The rollback pointer is used to indicate the position of the rollback record corresponding to the index tuple to be processed in the rollback log.

[0074] In practice, the database system can also receive rollback commands for index tuples. The database system can respond to these rollback commands by locating the index tuples to be processed as indicated by the command. For example... Figure 3 As shown, the field value of the rollback pointer field in the index tuple of this application is used to represent the undo pointer. The database system can read the undo pointer added to the index tuple to be processed, and determine the position of the undo record corresponding to the index tuple in the undo log based on the undo pointer. Therefore, the database system can read the undo record corresponding to the undo pointer from the undo log. Then, the database system can also parse the undo index tuple from the undo record and obtain the index key information of the index tuple to be processed through the undo index tuple.

[0075] For the convenience of those skilled in the art, Figure 4 A diagram illustrating the data structure of an Undo index tuple is provided. For example... Figure 4 As shown, the transaction identifier field (xid), command identifier field (cid), old transaction identifier field (old_xid), index key field (key), and prev undo pointer field are included.

[0076] Then, the database system can query the target index tuple corresponding to the index key information (key).

[0077] Because indexes can split, rollback requires re-locating and executing the rollback based on the index key information. Optionally, during the query for the target index tuple corresponding to the index key information, the database system can determine whether the index tuple to be processed has been split. If the index tuple to be processed has been split, the database system will locate the target index tuple in the split index page using the index key information. If the index tuple to be processed has not been split, the database system will locate the target index tuple in the original index page using the index key information.

[0078] Then, the database system can perform a rollback operation on the target index tuple. Specifically, the database system can determine the original operation type associated with the target index tuple, and then perform a rollback operation on the target index tuple according to the reverse operation of the original operation type associated with that target index tuple. For example, if the original operation type is an insert operation, the located target index tuple is deleted; if the original operation type is a delete operation, the located target index tuple is re-inserted.

[0079] The technical solution of this embodiment, by locating the index tuple to be processed indicated by the rollback command, reading the rollback pointer added to the index tuple to be processed, reading the rollback record corresponding to the rollback pointer in the rollback log, parsing the rollback index tuple from the rollback record, obtaining the index key information of the index tuple to be processed through the rollback index tuple, querying the target index tuple corresponding to the index key information, and performing a rollback operation on the target index tuple, can achieve efficient response to rollback commands and accurate and fast execution of rollback operations on the index tuple to be processed indicated by the rollback command.

[0080] In an exemplary embodiment, the method further includes: reading the modified transaction identifier added to the index tuple to be processed; the modified transaction identifier is used to characterize the transaction identifier corresponding to the insertion or deletion of the index tuple; if the modified transaction identifier of the index tuple to be processed is greater than or equal to the global oldest transaction identifier, the step of reading the rollback pointer added to the index tuple to be processed is performed.

[0081] In the specific implementation, before the database system executes the step of reading the rollback pointer added to the index tuple to be processed, the database system can read the modified transaction identifier (modified_xid) added to the index tuple to be processed. Then, the database system can compare the modified transaction identifier (modified_xid) with the global oldest transaction identifier (globalfronzexid). If the modified transaction identifier (modified_xid) is less than the global oldest transaction identifier (globalfronzexid), it means that the transaction associated with the index tuple to be processed is a terminated transaction and belongs to the category of transactions that have already been rolled back. The database system will not perform a rollback operation on the transaction associated with the index tuple to be processed.

[0082] If the modified transaction identifier of the pending index tuple is greater than or equal to the oldest global transaction identifier, it indicates that the transaction associated with the pending index tuple is not a terminated transaction and does not belong to a transaction that has been rolled back. The database system continues to perform a rollback operation on the transaction associated with the pending index tuple, that is, it performs the step of reading the rollback pointer added to the pending index tuple.

[0083] For ease of understanding by those skilled in the art, please refer to Figure 5 , Figure 5 This is a schematic diagram illustrating a method for processing index tuples in a database system. The commands involved in this index tuple processing method are shown below:

[0084]

[0085] create table student(id int primary key, age int, name text) usingxstore; / / primary index

[0086] Create an index on student(age); / / Secondary index

[0087] insert into student values(1, 10, 'Jim'); / / Transaction 100

[0088] begin;

[0089] `update student set age = age + 1 where id = 1;` / / Update the index column, transaction 101

[0090] rollback; / / Rollback operation

[0091] "

[0092] The technical solution of this embodiment reads the modified transaction identifier added to the index tuple to be processed. Only when the modified transaction identifier of the index tuple to be processed is greater than or equal to the global oldest transaction identifier is the step of reading the rollback pointer added to the index tuple to be processed executed. This allows for the effective determination of whether the transaction associated with the index tuple to be processed has been rolled back without needing to utilize the version information of the data corresponding to the index tuple to be processed. This avoids performing too many redundant operations, saves the computing resources of the database system, reduces the periodic fluctuations of the database system, and achieves the beneficial effect of improving the operational stability of the database system.

[0093] In an exemplary embodiment, the method further includes: reading the command identifier added to the rollback index tuple; and, if the command identifier in the rollback index tuple is less than the command identifier of the rollback command, performing a query on the target index tuple corresponding to the index key information and performing a rollback operation on the target index tuple.

[0094] In practice, before executing the query on the target index tuple corresponding to the index key information and performing a rollback operation on the target index tuple, the database system can read the command identifier (cid) added to the rollback index tuple. Then, the database system can compare the command identifier in the rollback index tuple with the command identifier of the rollback command. If the command identifier in the rollback index tuple is smaller than the command identifier of the rollback command, it means that the operation command corresponding to the rollback index tuple was executed before the rollback command. During rollback, the tuple corresponding to the operation of the rollback index tuple can be located through cid. After recovery, this tuple is visible to subsequent commands.

[0095] The technical solution of this embodiment reads the command identifier added to the rollback index tuple and compares the command identifier in the rollback index tuple with the command identifier of the rollback command. This enables visibility checks through the command identifier (cid) in the rollback index tuple, avoiding the need to re-check the data by reading it from the table. This saves the computing resources of the database system and improves the operational stability of the database system.

[0096] In another embodiment, such as Figure 6 As shown, a method for processing index tuples in a database system is provided, which can be applied to... Figure 1 Taking a database system as an example, the following steps are included:

[0097] Step S602: Locate the index tuple to be processed as indicated by the rollback command.

[0098] Step S604: Read the modified transaction identifier added to the index tuple to be processed; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple.

[0099] Step S606: If the modified transaction identifier of the index tuple to be processed is greater than or equal to the global oldest transaction identifier, read the rollback pointer added to the index tuple to be processed; the rollback pointer is used to represent the position of the rollback record corresponding to the index tuple to be processed in the rollback log.

[0100] Step S608: Read the rollback record corresponding to the rollback pointer from the rollback log, parse the rollback index tuple from the rollback record, and obtain the index key information of the index tuple to be processed through the rollback index tuple.

[0101] Step S610: Query the target index tuple corresponding to the index key information, and perform a rollback operation on the target index tuple.

[0102] It should be noted that the specific limitations of the above steps can be found in the specific limitations of the index tuple processing method for a database system described above.

[0103] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0104] Based on the same inventive concept, this application also provides an index tuple processing apparatus for implementing the index tuple processing method of the database system described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the index tuple processing apparatus for the database system provided below can be found in the limitations of the index tuple processing method for the database system described above, and will not be repeated here.

[0105] In one exemplary embodiment, such as Figure 7 As shown, an index tuple processing device for a database system is provided, comprising:

[0106] The reading module 710 is used to obtain the index tuple to be determined in the target index page and read the modified transaction identifier added to the index tuple to be determined; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple.

[0107] The acquisition module 720 is used to acquire the global oldest transaction identifier maintained in the rollback segment of the database system; the global oldest transaction identifier is used to represent the largest transaction identifier of all terminated transactions in the database system.

[0108] The determination module 730 is used to determine that the transaction associated with the index tuple to be determined is a terminated transaction when the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier.

[0109] In one embodiment, the apparatus is further configured to locate the index tuple to be processed indicated by the rollback command, read the rollback pointer added to the index tuple to be processed; the rollback pointer is used to characterize the position of the rollback record corresponding to the index tuple to be processed in the rollback log; read the rollback record corresponding to the rollback pointer in the rollback log, parse the rollback index tuple from the rollback record, obtain the index key information of the index tuple to be processed through the rollback index tuple; query the target index tuple corresponding to the index key information, and perform a rollback operation on the target index tuple.

[0110] In one embodiment, the apparatus is further configured to read the modified transaction identifier added to the index tuple to be processed; the modified transaction identifier is used to characterize the transaction identifier corresponding to the insertion or deletion of the index tuple; and if the modified transaction identifier of the index tuple to be processed is greater than or equal to the global oldest transaction identifier, the step of reading the rollback pointer added to the index tuple to be processed is performed.

[0111] In one embodiment, the device is further configured to, if the index tuple to be processed has been split, locate the target index tuple in the split index page using the index key information; and if the index tuple to be processed has not been split, locate the target index tuple in the original index page using the index key information.

[0112] In one embodiment, the apparatus is further configured to read the command identifier added to the rollback index tuple; and, if the command identifier in the rollback index tuple is less than the command identifier of the rollback command, execute the step of querying the target index tuple corresponding to the index key information and performing a rollback operation on the target index tuple.

[0113] In one embodiment, the terminated transaction includes at least one of a committed transaction or a rolled-back transaction.

[0114] Each module in the index tuple processing device of the aforementioned database system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independent of the processor in a computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.

[0115] In one exemplary embodiment, a computer device is provided, which may be a database system, and its internal structure diagram may be as follows: Figure 8 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a database system index tuple processing method.

[0116] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0117] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the index tuple processing method for a database system described above. The steps of the index tuple processing method for a database system described here can be the steps in the index tuple processing method for a database system from the various embodiments described above.

[0118] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the steps of the index tuple processing method for a database system described above. The steps of the index tuple processing method for a database system described here can be the steps in the index tuple processing method for a database system from the various embodiments described above.

[0119] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, causes the processor to perform the steps of the index tuple processing method for a database system described above. The steps of the index tuple processing method for a database system described here can be the steps in the index tuple processing method for a database system from the various embodiments described above.

[0120] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0121] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic resistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0122] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0123] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for processing index tuples in a database system, characterized in that, The method includes: Obtain the index tuple to be judged in the target index page, and read the modified transaction identifier added to the index tuple to be judged; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple; Obtain the oldest global transaction identifier maintained in the rollback segment of the database system; the oldest global transaction identifier is used to characterize the largest transaction identifier of all terminated transactions in the database system; If the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier, the transaction associated with the index tuple to be determined is determined to be a terminated transaction.

2. The method according to claim 1, characterized in that, The method further includes: Locate the index tuple to be processed indicated by the rollback command, and read the rollback pointer added to the index tuple to be processed; the rollback pointer is used to represent the position of the rollback record corresponding to the index tuple to be processed in the rollback log; Read the rollback record corresponding to the rollback pointer from the rollback log, parse the rollback index tuple from the rollback record, and obtain the index key information of the index tuple to be processed through the rollback index tuple; Query the target index tuple corresponding to the index key information, and perform a rollback operation on the target index tuple.

3. The method according to claim 2, characterized in that, The method further includes: Read the modified transaction identifier added to the index tuple to be processed; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple; If the modified transaction identifier of the index tuple to be processed is greater than or equal to the global oldest transaction identifier, the step of reading the rollback pointer added to the index tuple to be processed is performed.

4. The method according to claim 2, characterized in that, The query for the target index tuple corresponding to the index key information includes: If the index tuple to be processed has been split, the target index tuple can be located in the split index page using the index key information. If the index tuple to be processed has not been split, the target index tuple is located in the original index page using the index key information.

5. The method according to claim 2, characterized in that, The method further includes: Read the command identifier added to the rollback index tuple; If the command identifier in the rollback index tuple is less than the command identifier of the rollback command, the step of querying the target index tuple corresponding to the index key information and performing a rollback operation on the target index tuple is executed.

6. The method according to any one of claims 1 to 5, characterized in that, The terminated transaction includes at least one of a committed transaction or a rolled-back transaction.

7. An index tuple processing device for a database system, characterized in that, The device includes: The reading module is used to obtain the index tuple to be judged in the target index page and read the modified transaction identifier added to the index tuple to be judged; the modified transaction identifier is used to represent the transaction identifier corresponding to the insertion or deletion of the index tuple. The acquisition module is used to acquire the globally oldest transaction identifier maintained in the rollback segment of the database system; the globally oldest transaction identifier is used to represent the largest transaction identifier of all terminated transactions in the database system. The determination module is used to determine that the transaction associated with the index tuple to be determined is a terminated transaction if the modified transaction identifier of the index tuple to be determined is less than the oldest transaction identifier.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Multiversion concurrency control of database records with uncommitted transactions

    CN109923534A

  • Efficient in-memory multi-version concurrency control for a trie data structure based database

    CN112740197A

  • Data processing method and device based on nonvolatile storage space and related equipment

    CN119718191A

  • Index page management method, storage medium and equipment

    CN120523813A

  • Transaction processing method and device in database system and database system

    CN121029325A