Distributed query method, data processing method, server, product and storage medium

By maintaining historical status information in a distributed database system and utilizing the correspondence between the minimum active transaction number and the global transaction commit number, the problem of frequent non-clustered index table return operations in distributed queries is solved, thereby improving query efficiency.

WO2025196556A1PCT designated stage Publication Date: 2025-09-25CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/IB2025/052316
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-19
Filing Date
2025-03-04
Publication Date
2025-09-25

AI Technical Summary

Technical Problem

During distributed queries, table-back operations on non-clustered indexes result in high query costs, which cannot be effectively addressed by existing technologies.

Method used

By maintaining historical status information on the storage nodes of the distributed database system, recording the correspondence between at least one historical minimum active transaction number and the global transaction commit number, this information can be used to quickly determine the visibility of the target record to the query transaction, reducing table back operations.

Benefits of technology

This reduces the frequency of table-back operations required for non-clustered indexes, greatly improving query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025052316_25092025_PF_FP_ABST
    Figure IB2025052316_25092025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a distributed query method, a data processing method, a server, a product and a storage medium. In the distributed query method, a storage node can maintain historical state information thereof, wherein the historical state information stores the correspondence between at least one historical minimum active transaction number and a global transaction commit number on the storage node. On this basis, when a distributed query transaction regarding a target record in a non-clustered index is started, the storage node can trace back, on the basis of the historical state information, a target minimum active transaction number corresponding to a global transaction query number of the distributed query transaction, and quickly determine, on the basis of a maximum modification transaction number corresponding to the target record, and the target minimum active transaction number, whether the target record is visible to the query transaction.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Distributed query, data processing method, server, product and storage medium technical field

[0002]

[0001] The present disclosure relates to the field of computer technology, and more particularly to a distributed query, data processing method, server, product, and storage medium.

[0003] Database Management Systems (DBMSs) typically organize physical data using indexes. Common indexes include clustered indexes and non-clustered indexes. When the query condition is determined by the primary key, the clustered index can implement very efficient primary key queries. When the query condition is not determined by the primary key, fast queries can be implemented by querying the non-clustered index. When certain information (e.g., version information) about a data row is not recorded in the non-clustered index, it is necessary to search the clustered index using the primary key information corresponding to the index column in the non-clustered index to obtain information corresponding to the query condition. This process of searching the clustered index based on the primary key is commonly referred to as table retrieval.

[0004]

[0003] However, in the distributed query process, the table return operation of the non-clustered index has a high query cost. Therefore, a new solution is needed.

[0005]

[0004] Various aspects of the present disclosure provide a distributed query, data processing method, server, product, and storage medium to reduce the frequency of table returns during a distributed query process, thereby reducing the query cost of the distributed query operation.

[0006]

[0005] An embodiment of the present disclosure provides a distributed query method, which is applicable to any storage node in a distributed database system, comprising: receiving a query transaction for a target record in a non-clustered index; querying historical status information of the target record based on a global transaction query number of the query transaction to obtain a target minimum active transaction number corresponding to the global transaction query number; the historical status information saves a correspondence between at least one historical minimum active transaction number and a global transaction commit number on the storage node; judging whether the target record is visible to the query transaction based on a maximum modification transaction number corresponding to the target record and the target minimum active transaction number; and returning the target record as a query result if the target record is visible to the query transaction.

[0007]

[0006] Optionally, querying historical status information according to the global transaction query number of the query transaction to obtain a target minimum active transaction number corresponding to the global transaction query number includes: querying, among the global transaction commit numbers corresponding to the at least one historical minimum active transaction number, a maximum global transaction commit number that is smaller than the global transaction query number; and using, among the at least one historical minimum active transaction number, the minimum active transaction number corresponding to the maximum global transaction commit number as the target minimum active transaction number.

[0008]

[0007] Optionally, the historical state information is stored in a queue; any historical minimum active transaction number and its corresponding global transaction commit number are stored as an element in the queue; and among the global transaction commit numbers corresponding to the at least one historical minimum active transaction number, querying a maximum global transaction commit number that is smaller than the global transaction query number includes: starting from the most recently written element in the queue, reading the global transaction commit numbers corresponding to the historical minimum active transaction numbers one by one, and comparing the read global transaction commit numbers with the global transaction query number until a first global transaction commit number smaller than the global transaction query number is found, which is used as the maximum global transaction commit number.

[0009]

[0008] Optionally, the method further includes: obtaining the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number; and, at the at least one historical moment, obtaining the system sequence number maintained by the storage node as the global transaction commit number corresponding to the at least one historical minimum active transaction number; and storing the correspondence between the at least one historical active transaction number and its corresponding global transaction commit number in the historical status information of the storage node.

[0010]

[0009] Optionally, obtaining the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number includes: each time the system sequence number maintained by the storage node is updated, obtaining the minimum active transaction number corresponding to the storage node at the update moment as the historical minimum active transaction number corresponding to the update moment.

[0011]

[0010] Optionally, obtaining the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number includes: when any cycle arrives, obtaining the minimum active transaction number of the target record at the cycle arrival moment as the historical minimum active transaction number corresponding to the cycle arrival moment.

[0012]

[0011] Optionally, it further includes: when the storage node commits any distributed write transaction, if the global transaction commit number of the distributed write transaction is greater than the system sequence number currently maintained by the storage node, then updating the system sequence number currently maintained by the storage node according to the global transaction commit number of the distributed write transaction; or, when the storage node receives any distributed query transaction, if the global transaction query number of the distributed query transaction is greater than the system sequence number currently maintained by the storage node, then updating the system sequence number currently maintained by the storage node according to the global transaction query number of the distributed query transaction.

[0013]

[0012] Embodiments of the present disclosure also provide a data processing method, applicable to any storage node in a distributed database system, comprising: obtaining the minimum active transaction number of the storage node at at least one historical moment, as the at least one historical minimum active transaction number; and, at the at least one historical moment, obtaining a system sequence number maintained by the storage node, as the global transaction commit number corresponding to the at least one historical minimum active transaction number; storing the correspondence between the at least one historical active transaction number and its corresponding global transaction commit number in historical status information of the storage node, so that upon receiving a distributed query transaction for a target record, visibility determination is performed on the target record on the storage node based on the historical status information and the maximum modified transaction number of the data page corresponding to the target record; the target record is in a non-clustered index of the storage node. Embodiments of the present disclosure also provide a server, comprising: a memory and a processor; the memory is configured to store one or more computer instructions; and the processor is configured to execute the one or more computer instructions to perform the steps of the method provided in the embodiments of the present disclosure.

[0014]

[0013] The embodiment of the present disclosure also provides a computer-readable storage medium storing a computer program, which can implement the steps in the method provided in the embodiment of the present disclosure when the computer program is executed by a processor.

[0015]

[0014] The embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, which can implement the steps in the method provided in the embodiment of the present disclosure when the computer program / instruction is executed by a processor.

[0016]

[0015] In the distributed query method provided by the embodiment of the present disclosure, the storage node can maintain its historical status information, which saves the correspondence between at least one historical minimum active transaction number and the global transaction commit number on the storage node. Based on this, when a distributed query transaction for a target record in a non-clustered index is initiated, the storage node can backtrack to the target minimum active transaction number corresponding to the global transaction query number of the query transaction based on the historical status information, and quickly determine whether the target record is visible to the query transaction based on the maximum modification transaction number and the target minimum active transaction number corresponding to the target record. In addition, the frequency with which the non-clustered index needs to perform a table return operation to perform visibility judgment is reduced, which greatly reduces the query overhead and improves the query efficiency.

[0017]

[0016] The drawings described herein are intended to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are intended to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the drawings:

[0018] FIG1 is a schematic diagram showing an update of status information of a stand-alone write transaction;

[0019]

[0018] FIG2 is a schematic diagram of the visibility determination process of a single-machine query transaction;

[0020]

[0019] FIG3 is a schematic diagram of a process flow of a distributed query method provided by an exemplary embodiment of the present disclosure;

[0021]

[0020] FIG4 is a schematic diagram of using a circular queue to store historical status information provided by an exemplary embodiment of the present disclosure;

[0022] FIG5 is a flow chart of a data processing method according to an exemplary embodiment of the present disclosure;

[0023]

[0022] FIG6 is a schematic diagram of the structure of a server provided by an exemplary embodiment of the present disclosure.

[0024] To make the objectives, technical solutions, and advantages of the present disclosure more clearly apparent, the technical solutions of the present disclosure will be described clearly and completely below in conjunction with specific embodiments of the present disclosure and corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present disclosure, and are not all of the embodiments. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present disclosure without inventive effort are within the scope of protection of the present disclosure.

[0025]

[0024] The terms used in the embodiments of the present invention are intended only to describe specific embodiments and are not intended to limit the present invention. The singular forms "a," "an," "the," and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms. Unless the context clearly indicates otherwise, "multiple" generally includes at least two, but does not exclude the inclusion of at least one.

[0026]

[0025] It should be understood that the term "and / or" used herein is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may mean: A exists alone, A and B exist at the same time, and B exists alone.

[0027]

[0026] It should also be noted that the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a product or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such product or system. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of other identical elements in the product or system comprising the element.

[0028] Database management systems typically use indexes to organize physical data. Through indexes, database management systems can quickly find required data at a very low cost. Theoretically, searching for data through an index can reduce the cost to a logarithmic level compared to a full search. Clustered indexes (i.e., primary key indexes) are the most commonly used indexes in database management systems. Using clustered indexes, queries can directly retrieve all data in a corresponding row. Furthermore, database management systems typically include version information for the rows in the clustered index. When a query is initiated, the database management system compares the query view information with the version information for the rows in the clustered index to determine the version record that the query is looking for. If the current version in the clustered index does not meet the query requirements, the database management system's redo log must be used to construct a historical version of the corresponding record.

[0029] When the query condition is determined by the primary key, a clustered index can implement a very efficient primary key query. When the query condition is not determined by the primary key, a full scan of the data page is required. To solve the problem of requiring a full scan for non-primary key queries, non-clustered indexes are introduced. The first important difference between non-clustered indexes and clustered indexes is that non-clustered indexes do not include all the data information of the data row; they only store the index column information and the corresponding primary key information. When the query condition is determined by the index column, the corresponding primary key information can be directly found through the non-clustered index. Furthermore, if other information in the data row needs to be queried, the clustered index can be queried based on the found primary key to find the complete data row information.

[0030]

[0029] The following will combine Table 1 and Table 2 to illustrate the clustered index and non-clustered index using specific examples. Table 1. Clustered index

[0031]

[0030] As shown in Table 1, when the student number is used as the query condition, all data such as the class, grade and version number recorded in each data row can be queried. Table 2. Class-Student Number Index (Non-Clustered Index)

[0032] As shown in Table 2, when querying all student numbers of Class 2, "Class 2" can be used as a query condition to query the non-clustered index.

[0033] A second important difference between non-clustered indexes and clustered indexes is that non-clustered indexes do not have version information, and queries can only find the latest version of a data row using the non-clustered index. When searching a non-clustered index based on a query condition, it is first necessary to determine whether the version of the data row in the non-clustered index is the version required by the query. If the non-clustered index does not have version information, it is necessary to search the clustered index using the primary key information corresponding to the index column to obtain the version information corresponding to the query condition. This process of searching the clustered index using the primary key is commonly referred to as a table return. However, the table return operation during the query process can at least double the query cost.

[0034] In some scenarios, when no new transactions occur in the database for a long period of time, each row of the non-clustered index involved in a new query requires a table back-end query operation, resulting in a high table back-end cost. The table back-end query requires a complete clustered index search. In more serious cases, when the clustered index is not stored in memory, multiple slow storage media accesses are required, which further degrades the overall database performance.

[0035] To address the above issues, some database management systems have introduced a minimum active transaction number. This minimum active transaction number assists in determining the visibility of non-clustered indexes, significantly reducing the number of table lookups and significantly reducing search costs. An active transaction refers to a transaction that has been initiated but not yet committed. The transaction number, also known as the transaction ID (Identity), uniquely identifies the transaction. Typically, a database management system maintains a transaction ID generator for generating globally unique, monotonically increasing transaction IDs. As shown in FIG1 , when a write transaction is initiated, it obtains a transaction ID from the transaction ID generator as its own transaction identifier. Furthermore, some typical database management systems maintain a special persistent field on each data page of a non-clustered index: max_trx_id, which indicates the maximum transaction ID among all transactions that have modified the data page (hereinafter referred to as the maximum modified transaction number). As shown in Figure 1, a write transaction can modify a record in a non-clustered index. The maximum modification transaction number of the data page containing the record is obtained, and the write transaction ID is determined to be greater than the maximum modification transaction number. If the write transaction ID is greater than the maximum modification transaction number, the write transaction ID is updated to the maximum modification transaction number. That is, max_trx_id = write transaction ID. The transaction is then committed and the local transaction commit number is obtained. If the write transaction ID is less than the maximum modification transaction number, the transaction is committed directly and the local commit number is obtained.

[0036] At the same time, the database management system also maintains a global state variable: min_active_trx_id, which is used to indicate the smallest transaction ID (i.e., the minimum active transaction number) among all active transactions. Transactions with transaction IDs less than min_active_trx_id are committed. As shown in FIG1 , when a write transaction is committed, the local transaction commit number is obtained and a determination is made as to whether the write transaction ID is the smallest among all active transactions on the storage node. If so, the write transaction ID is updated to the minimum active transaction number. That is, min_active_trx_id = write transaction ID. After the write transaction is committed, the write transaction is removed from the active transaction list. If the write transaction ID is not the smallest among all active transactions on the storage node, the step of removing the write transaction from the active transaction list is directly executed. In some cases, when there are no active transactions on the storage node, the maximum transaction ID on the storage node can be used as the minimum active transaction number.

[0037] When a query transaction is initiated, as shown in FIG2 , a query view can be constructed. This query view consists of the database management system's current local commit number and the minimum active transaction number. When searching a non-clustered index, after locating a record in the non-clustered index, visibility can be determined by comparing the minimum active transaction number with the record's maximum modification transaction number. If the minimum transaction activity number is greater than the record's maximum modification transaction number, the record is visible; otherwise, visibility can be determined by retrieving the table.

[0038]

[0037] In a stand-alone database management system, the visibility judgment mechanism based on the minimum active transaction number and the maximum modified transaction number can significantly reduce the number of table returns during a stand-alone query process.

[0039] However, the query methods based on clustered and non-clustered indexes are applicable to stand-alone databases and are not suitable for distributed database systems. A distributed database management system is a software system used to support the management of distributed databases. It is responsible for the establishment, querying, updating, replication, management, and maintenance of distributed databases, ensuring the transparency of the physical distribution of data in the distributed database to users. A distributed database is a logically unified database composed of multiple physically dispersed database units connected using a computer network. In a distributed database, each connected database unit is called a site or node (i.e., a storage node). Each storage node runs the corresponding storage engine component of the distributed database management system.

[0040]

[0039] A distributed transaction generally refers to a transaction involving multiple storage nodes. Generally, a distributed transaction requires initiating a local transaction on each storage node. Such a local transaction is generally referred to as a branch transaction. Distributed transactions themselves must also meet the ACID properties of transactions. The ACID properties refer to the four properties that transactions must meet: atomicity, consistency, isolation, and durability.

[0041] In a distributed database management system, the commit order of all distributed transactions is not generated locally, but rather uniformly by an external global coordinator. This means that the actual commit order of branch transactions of multiple distributed transactions on each node may be different. For example, multiple branch transactions of the same distributed transaction may have the same global transaction commit number.

[0042] While multiple branch transactions have different local transaction commit numbers (SCNs) on their respective nodes, distributed queries are significantly more complex than standalone queries. In distributed database management systems, distributed query transactions utilize flashback queries. A flashback query queries the data in a table corresponding to a specific past point in time or a specific local transaction commit number (SCN). Flashback queries are implemented based on rollback information in the undo tablespace.

[0043] Unlike stand-alone queries, the version number of a distributed query view is the global transaction query number GCN (hereinafter referred to as snapshot_GCN) assigned by an external global coordinator, rather than being derived from the latest local state (i.e., the minimum active transaction number) in the database management system. Due to network and system scheduling issues, by the time the distributed query view version number is delivered to a storage node, the transaction system state within the node may have changed multiple times, making the node's latest minimum active transaction number no longer applicable for constructing the distributed query view. For example, in a distributed database management system, a compute node (CN) initiates a distributed query transaction R at time T1 and obtains a global query number GCN=99 from the global coordinator. At time T2, a write transaction A on the storage node updates record a in a non-clustered index and commits the transaction. The transaction number of this write transaction A is trx_id=90 and GCN=100. At this point, the maximum modification transaction number for data page page_a, where record a resides, is updated to max_trx_id = 90. At time T3, a write transaction B on the storage node is committed, but it does not update data page page_a. At this point, the maximum modification transaction number for data page page_a, max_trx_id, is 91. At time T4, a distributed query transaction R arrives at the storage node. If there are no active transactions on the storage node, the maximum transaction number on the storage node is used as the minimum active transaction number, i.e., the obtained minimum active transaction number, up_limit_id = 91. At this point, the query view for query transaction R is {snapshot_GCN = 99, up_limit_id = 91}. In this case, if max_trx_id < up_limit_id for page_a, then all records on page_a are visible to query transaction R. However, in reality, the snapshot_GCN of query transaction R is smaller than the GCN of write transaction A corresponding to record a, that is, (snapshot_GCN=99) < (GCN=100). Therefore, record a is invisible to query transaction R.

[0044]

[0042] Based on the above examples, it can be seen that the query optimization method based on the non-clustered index designed for single-machine query is no longer effective for distributed query.

[0045] In response to the above technical problems, some embodiments of the present disclosure provide a solution for reducing the additional table return cost associated with searching for version information based on non-clustered indexes in a distributed database management system. The technical solutions provided by various embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0046]

[0044] FIG3 is a flow chart of a distributed query method provided by an exemplary embodiment of the present disclosure. The method may include the steps shown in FIG3.

[0047]

[0045] Step 301: Obtain the minimum active transaction number of the storage node at at least one historical moment as at least one historical minimum active transaction number.

[0048]

[0046] Step 302: At the at least one historical moment, obtain the system sequence number maintained by the storage node, and use it as the global transaction commit number corresponding to the at least one historical minimum active transaction number.

[0049]

[0047] Step 303: Store the correspondence between the at least one historical active transaction number and its corresponding global transaction commit number in the historical status information of the storage node, so as to be used for determining the visibility of the target record on the storage node based on the historical status information and the maximum modification transaction number corresponding to the target record when a distributed query transaction for the target record is received; the target record is in a non-clustered index in the storage node.

[0050]

[0048] This embodiment is executed by any storage node in a distributed database management system. The storage node refers to a database unit in a distributed database. The database unit can be located on a physical server or a cloud server, which is not limited in this embodiment.

[0051]

[0049] A historical moment refers to any past moment relative to the current moment. An active transaction at a historical moment refers to a transaction that has been initiated but not yet committed at a historical moment. The minimum active transaction number at a historical moment refers to the smallest transaction number among active transactions at a historical moment. In this embodiment, a storage node may obtain and save the minimum active transaction numbers of one or more historical moments to facilitate flashback query operations for distributed query transactions. The system sequence number maintained by a storage node is the maximum global sequence number of all distributed transactions occurring on the storage node. In a distributed database management system, each storage node may maintain its own system sequence number. Unlike the global sequence number, the system sequence number maintained by any node is not directly obtained from an external global coordinator, but is determined based on the global commit number of the storage node's most recently submitted distributed write transaction or the global transaction query number of the most recently received distributed query transaction.

[0052]

[0050] The global transaction commit number (GCN) of a distributed write transaction refers to a globally unique sequence number generated by an external global coordinator for the distributed write transaction, and is used to identify the commit order of the distributed write transaction. Multiple branch transactions of the same distributed write transaction have the same global transaction commit number. The global transaction query number of a distributed query transaction refers to a globally unique sequence number generated by an external global coordinator for the distributed query transaction, and is used to identify the initiation order of the distributed query transaction. The global transaction query number of a distributed query transaction is labeled "snapshot_GCN". In some embodiments, the global transaction query number of a distributed query transaction may be the largest global transaction commit number at the time the distributed query transaction is initiated.

[0053]

[0051] Optionally, when a storage node commits any distributed write transaction, if the global transaction commit number of the distributed write transaction is greater than the system sequence number currently maintained by the storage node, the storage node may update the system sequence number currently maintained by the storage node based on the global transaction commit number of the distributed write transaction. When a storage node receives any distributed query transaction, if the global transaction query number of the distributed query transaction is greater than the system sequence number currently maintained by the storage node, the storage node may update the system sequence number currently maintained by the storage node based on the global transaction query number of the distributed query transaction.

[0054]

[0052] The system sequence number maintained by the storage node can be marked as sys_GCN, and its update method can be further described as follows:

[0055]

[0053] 1. If a distributed query transaction received by a storage node is assigned a global transaction query number (labeled as snapshot_GCN) by an external global coordinator as a distributed query view, then the system sequence number sys_GCN = max{sys_GCN, snapshot_GCN}», where max() is a maximum value function.

[0056]

[0054] 2. If the distributed transaction submitted by the storage node is assigned a global transaction submission number (marked as GCN) by an external global coordinator as the submission number of the distributed transaction, then the system sequence number sys_GCN=max{sys_GCN,GCN}.

[0057] At any historical moment, the storage node can use the system sequence number maintained at that historical moment as the global transaction commit number corresponding to the minimum active transaction number at that historical moment. That is, the sys_GCN at that historical moment is used as the GCN corresponding to the minimum active transaction number at that historical moment.

[0058] The storage node may store the correspondence between the at least one historical active transaction number and its corresponding global transaction commit number in the storage node's historical status information, so that when a distributed query transaction is received, visibility determination of the target record is performed based on the historical status information. The historical status information may be stored in an independent memory structure on the storage node for easy querying.

[0059]

[0057] In some optional embodiments A1, the at least one historical moment may be the moment each time the target record is updated. In this embodiment, each time the system sequence number maintained by the storage node is updated, the storage node may obtain the minimum active transaction number corresponding to the update moment, as the historical minimum active transaction number corresponding to the update moment. In this embodiment, all global transaction commit numbers updated by the storage node within a certain time window can be recorded. The time window refers to a time window with a specified time length before the current moment to store recent historical system status. For example, 30 minutes before the current moment, or 10 minutes before the current moment. In this embodiment, recording the full amount of historical status information can greatly reduce the frequency of table returns when querying non-clustered indexes, greatly improving query efficiency.

[0060] In some optional embodiments A2, the storage node may periodically update historical status information. Accordingly, the at least one historical moment may be the moment at which each cycle arrives. In this embodiment, when any cycle arrives, the storage node may obtain the minimum active transaction number of the target record at the moment at which the cycle arrives, and use this as the historical minimum active transaction number corresponding to the moment at which the cycle arrives. For example, the length of the cycle may be 1 second, 3 seconds, 5 seconds, or other lengths, which are not limited in this embodiment.

[0061]

[0059] Compared with embodiment A1, periodically recording historical status information instead of recording the entire amount of historical status information can fully balance the query efficiency and the resource overhead required for recording historical status information, thereby achieving higher query efficiency at a lower cost.

[0062]

[0060] In some optional embodiments, the historical state information is stored in a queue, which can be a linear queue or a circular queue. In some distributed database management systems, the storage node can use a commit snapshot manager.

[0063] The Commit Snapshot Manager (CSM) manages and maintains the historical status information of storage nodes. The Commit Snapshot Manager is a circular queue of a certain length, as shown in Figure 4. At any historical moment, the minimum active transaction number of a storage node at that moment and its global transaction commit number are available. The minimum active transaction number and its corresponding global transaction commit number are written into the circular queue as a CSM element. When the circular queue is full, the next CSM element written overwrites the first CSM element written in the queue, and so on. This circular queue effectively utilizes memory space and maintains the status information of storage nodes at historical moments at a low cost. This helps reduce the frequency of table lookups for non-clustered indexes in distributed query scenarios, improving distributed query efficiency.

[0064]

[0061] Figure 5 is a flow chart of a distributed query method provided by an exemplary embodiment of the present disclosure, and the method may include the steps shown in Figure 5.

[0062] Step 501: Receive a query transaction for a target record in a non-clustered index.

[0065]

[0063] Step 502: Query the historical status information of the target record according to the global transaction query number of the query transaction to obtain the target minimum active transaction number corresponding to the global transaction query number; the historical status information stores the correspondence between at least one historical minimum active transaction number on the storage node and the global transaction commit number.

[0066]

[0064] Step 503: Determine whether the target record is visible to the query transaction based on the maximum modification transaction number corresponding to the target record and the target minimum active transaction number.

[0067]

[0065] Step 504: If the target record is visible to the query transaction, return the target record as the query result.

[0068]

[0066] This embodiment is executed by any storage node in a distributed database management system. When a storage node receives a query transaction for a target record, it can use a flashback query method to query a certain version of the target record.

[0069]

[0067] The target record refers to the data stored in the storage node, such as user data or system data, and a row of data in a data table is described as a record or a data row.

[0070]

[0068] The query transaction refers to a distributed query transaction. The global transaction query number of the query transaction refers to a globally unique sequence number generated by an external global coordinator for the distributed query transaction, which is used to identify the initiation order of the distributed query transaction. The global transaction query number of the distributed query transaction is marked as snapshot_GCN. In some embodiments, the global transaction query number of the distributed query transaction can be the largest global transaction commit number when the distributed query transaction is initiated.

[0071] After receiving a query transaction, the storage node may query the historical status information of the target record based on the global transaction query number of the query transaction. The historical status information includes a correspondence between at least one historical minimum active transaction number and a global transaction commit number. In this embodiment, the storage node may obtain the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number, and may also obtain the system sequence number maintained by the storage node at the at least one historical moment as the global transaction commit number corresponding to the at least one historical minimum active transaction number. For details, please refer to the description of the aforementioned embodiment and will not be further described here.

[0072]

[0070] The target historical minimum active transaction number is one of the at least one historical minimum active transaction number. The target historical minimum active transaction number is the same as or similar to the actual minimum active transaction number on the storage node when the query transaction is started.

[0073] In some scenarios, the storage node uses the aforementioned embodiment A1 to obtain the historical minimum active transaction number. In this case, the global transaction commit number of the at least one historical moment stored in the historical status information is the total global transaction commit number of the storage node within a certain past time window. If the global transaction query number of the distributed query transaction continues to use the largest global transaction commit number when the distributed query transaction was initiated, then when querying the historical status information of the target record based on the global transaction query number of the query transaction, a global transaction commit number identical to the global transaction query number may be found. After obtaining the global transaction commit number identical to the global transaction query number based on the above embodiment, the minimum active transaction number corresponding to the found global transaction commit number among the at least one historical minimum active transaction number may be used as the target minimum active transaction number.

[0074]

[0072] The following will be described with reference to specific examples. For example, the state changes occurring on the storage node are as follows.

[0075] At time T1, a distributed write transaction is committed in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN=101. The historical status information stores the correspondence between the minimum active transaction number at time T1 and the global transaction commit number, recorded as (ID1=11, GCN1=101).

[0076] At time T2, a distributed query transaction is initiated in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN=102. The historical status information stores the correspondence between the minimum active transaction number and the global transaction commit number at time T2, recorded as (ID2=11, GCN2=102).

[0077] At time T3, a distributed write transaction is committed in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN=103. The historical status information stores the correspondence between the minimum active transaction number and the global transaction commit number at time T1, recorded as (ID3=12, GCN3=103).

[0078]

[0076] The query transaction initiated at time T2 is sent to the storage node at time T4. When the storage node queries the historical status information based on the global transaction query number snapshot_GCN=102 of the query transaction, it can query snapshot_GCN=GCN2=102. o In this case, the storage node may use ID2=12 as the target minimum active transaction number corresponding to the global transaction query number snapshot_GCN=102.

[0079] After obtaining the target minimum active transaction, the storage node can determine whether the target record is visible to the query transaction based on the maximum modification transaction number corresponding to the target record and the target minimum active transaction number. The maximum modification transaction number corresponding to the target record refers to the largest transaction ID among all transactions that have modified the data page where the target record is located.

[0080] If the maximum modification transaction number is less than the target minimum active transaction number, the target record is determined to be visible to the query transaction. Conversely, if the maximum modification transaction number is greater than the target minimum active transaction number, whether the target record is visible to the query transaction can be determined by querying the clustered index in the table back.

[0081] In other scenarios, the storage node uses the aforementioned embodiment A2 to obtain the historical minimum active transaction number. In this case, the global transaction commit number of the at least one historical moment stored in the historical status information is a portion of the global transaction commit numbers of the storage node within a certain time window. When querying the historical status information of the target record based on the global transaction query number of the query transaction, a global transaction commit number that is relatively similar to the global transaction query number can be found. Optionally, in this embodiment, the storage node can query the global transaction commit numbers corresponding to the at least one historical minimum active transaction number for the maximum global transaction commit number that is smaller than the global transaction query number. In other words, the maximum global transaction commit number is the largest of the global transaction commit numbers that are smaller than the global transaction query number.

[0082]

[0080] Optionally, when historical state information is stored in a queue, any historical minimum active transaction number and its corresponding global transaction commit number are stored as an element in the queue. Accordingly, the storage node may read the global transaction commit numbers corresponding to the historical minimum active transaction numbers one by one, starting from the most recently written element in the queue, and compare the read global transaction commit numbers with the global transaction query number until the first global transaction commit number smaller than the global transaction query number is found, which is used as the maximum global transaction commit number. In this manner, starting from the end of the queue, the maximum global transaction commit number can be quickly found based on the monotonically increasing nature of global transaction commits. After obtaining the maximum global transaction commit number based on the above embodiment, the minimum active transaction number corresponding to the maximum global transaction commit number among the at least one historical minimum active transaction number may be used as the target minimum active transaction number.

[0083]

[0081] The following will be described with reference to specific examples. For example, the state changes occurring on the storage node are as follows.

[0084]

[0082] At time TO, a distributed write transaction W is committed in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN0=100. o At time TO, the minimum active transaction on the storage node is write transaction W0. If the transaction ID of write transaction W0 is 10, then the minimum active transaction number ID0 is 10.

[0085] At time T1, a distributed write transaction W0 is committed in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN1=10L. At time T1, the minimum active transaction on the storage node is the write transaction W1. If the transaction ID of the write transaction W1 is 11, the minimum active transaction ID1 on the storage node is 11.

[0086] At time T2, a distributed query transaction R is initiated in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN2=102. o At time T2, the write transaction W1 is not committed, so the minimum active transaction on the storage node is still the write transaction W1, and the minimum active transaction number ID2 on the storage node is 1 L

[0087] At time T3, a distributed write transaction W1 is committed in the distributed database management system, and the sys_GCN maintained by the storage node is updated to sys_GCN3 = 103. At time T3, the minimum active transaction on the storage node is the write transaction W2. If the transaction ID of the write transaction W2 is 12, the minimum active transaction ID3 on the storage node is 12.

[0088] At time T4, a distributed write transaction W2 is committed in the distributed database management system, and sys_GCN maintained by the storage node is updated to sys_GCN4=10L. At time T4, the minimum active transaction on the storage node is the write transaction W3. If the transaction ID of the write transaction W3 is 13, the minimum active transaction ID4 on the storage node is 13.

[0089]

[0087] Assume that between time T0 and time T1, the state information of the storage node is recorded, specifically {ID0=10, sys_GCN0=100} o Between T3 and T4, the storage node's state information is recorded, specifically {ID3=12, sys_GCN3=103}. Query transaction R, initiated at T2, is delivered to the storage node at T4. When the storage node queries historical state information based on the global transaction query number snapshot_GCN of query transaction R, it finds that the largest global transaction commit number less than snapshot_GCN is sys_GCNO, i.e., (sys_GCN0=100) < (snapshot_GCN=102). In this case, the storage node uses ID0=10 as the target minimum active transaction number corresponding to the global transaction query number snapshot_GCN=102.

[0090]

[0088] In this case, at time T2, the global transaction query number snapshot_GCN=102 actually corresponds to the minimum active transaction number ID2=11, and the queried target minimum active transaction number ID0=10 is similar to and smaller than the actual minimum active transaction number.

[0091] After obtaining the target minimum active transaction, the storage node can determine whether the target record is visible to the query transaction based on the maximum modification transaction number and the target minimum active transaction number corresponding to the target record. If the maximum modification transaction number is less than the target minimum active transaction number, the target record is determined to be visible to the query transaction. Continuing with the above example, if the queried minimum active transaction number ID0=10 is approximately equal to and less than the actual minimum active transaction number ID2=11, and if the maximum modification transaction number of the target record is less than the target minimum active transaction number ID0=10, then the maximum modification transaction number of the target record is necessarily less than the minimum active transaction number ID2=11 actually corresponding to the global transaction query number snap shot_GCN=102. That is, the target record is definitely visible to the query transaction. If the target record is visible to the query transaction, the storage node can return the target record as the query result. Conversely, if the maximum modification transaction number is greater than the target minimum active transaction number, the target record can be determined to be visible to the query transaction by returning the table.

[0092] In this embodiment, by maintaining the historical status information of the target record, the distributed query view can trace back the minimum active transaction number in history, thereby enabling the distributed query transaction to quickly perform visibility determination using the traced minimum active transaction number and the maximum modified transaction number of the target record. Based on this embodiment, the frequency of performing table back operations for visibility determination on non-clustered indexes is reduced, significantly reducing query overhead and improving query efficiency.

[0093] Furthermore, in some embodiments, by periodically recording historical status information rather than recording all historical status information, a balance can be achieved between query efficiency and the resource overhead required for recording historical status information, thereby achieving higher query efficiency at a lower cost. Furthermore, when periodically recording historical status information, the target minimum active transaction number queried based on the global transaction query number is a more pessimistic value relative to the actual minimum active transaction number, and does not affect the accuracy of the visibility determination result.

[0094] It should be noted that the execution entity of each step of the method provided in the above embodiment may be the same device, or the method may be executed by different devices. For example, the execution entity of steps 501 to 504 may be device A; for another example, the execution entity of steps 501 and 502 may be device A, and the execution entity of step 503 may be device B; and so on.

[0095]

[0093] In addition, some of the processes described in the above embodiments and accompanying drawings include multiple operations that appear in a specific order. However, it should be understood that these operations may not be executed in the order in which they appear herein or may be executed in parallel. Operation sequence numbers, such as 501 and 502, are merely used to distinguish between different operations and do not represent any specific order of execution. In addition, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the terms "first" and "second" herein are used to distinguish between different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.

[0096]

[0094] 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, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0097]

[0095] FIG6 illustrates a schematic structural diagram of a server provided by an exemplary embodiment of the present disclosure. As shown in FIG6, the server includes: a memory 601, a processor 602, and a communication component 603.

[0098]

[0096] The memory 601 is used to store computer programs and can be configured to store various other data to support operations on the server. Examples of such data include instructions for any application or method used to operate on the server.

[0099]

[0097] In some embodiments, the server shown in FIG6 may be used to execute a distributed query method, wherein a processor 602 is coupled to a memory 601 and is configured to execute a computer program in the memory 601, configured to: receive a query transaction for a target record in a non-clustered index; query historical status information of the target record based on a global transaction query number of the query transaction to obtain a target minimum active transaction number corresponding to the global transaction query number; the historical status information stores a correspondence between at least one historical minimum active transaction number and a global transaction commit number on the storage node; determine whether the target record is visible to the query transaction based on a maximum modification transaction number corresponding to the target record and the target minimum active transaction number; and if the target record is visible to the query transaction, return the target record as a query result.

[0100]

[0098] Optionally, when the processor 602 queries historical status information according to the global transaction query number of the query transaction and obtains a target minimum active transaction number corresponding to the global transaction query number, the processor 602 is specifically configured to: query, among the global transaction commit numbers corresponding to the at least one historical minimum active transaction number, a maximum global transaction commit number that is smaller than the global transaction query number; and use, among the at least one historical minimum active transaction number, the minimum active transaction number corresponding to the maximum global transaction commit number as the target minimum active transaction number.

[0101]

[0099] Optionally, the historical state information is stored in a queue, and any historical minimum active transaction number and its corresponding global transaction commit number are stored as an element in the queue. When searching for a maximum global transaction commit number that is smaller than the global transaction query number among the global transaction commit numbers corresponding to the at least one historical minimum active transaction number, the processor 602 is specifically configured to: start from the most recently written element in the queue, read the global transaction commit numbers corresponding to the historical minimum active transaction numbers one by one, and compare the read global transaction commit numbers with the global transaction query number until a first global transaction commit number smaller than the global transaction query number is found, and use the first global transaction commit number as the maximum global transaction commit number.

[0102]

[0100] Optionally, the processor 602 is further configured to: obtain a minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number; and, at the at least one historical moment, obtain a system sequence number maintained by the storage node as a global transaction commit number corresponding to the at least one historical minimum active transaction number; and store the correspondence between the at least one historical active transaction number and its corresponding global transaction commit number in the historical status information of the storage node.

[0103]

[0101] Optionally, when the processor 602 obtains the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number, it is specifically used to: obtain the minimum active transaction number corresponding to the storage node at the update moment each time the system sequence number maintained by the storage node is updated, as the historical minimum active transaction number corresponding to the update moment.

[0104]

[0102] Optionally, when the processor 602 obtains the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number, it is specifically used to: when any cycle arrives, obtain the minimum active transaction number of the target record at the cycle arrival moment as the historical minimum active transaction number corresponding to the cycle arrival moment.

[0105]

[0103] Optionally, the processor 602 is further configured to: when the storage node commits any distributed write transaction, if the global transaction commit number of the distributed write transaction is greater than the system sequence number currently maintained by the storage node, update the system sequence number currently maintained by the storage node according to the global transaction commit number of the distributed write transaction; or, when the storage node receives any distributed query transaction, if the global transaction query number of the distributed query transaction is greater than the system sequence number currently maintained by the storage node, update the system sequence number currently maintained by the storage node according to the global transaction query number of the distributed query transaction.

[0106]

[0104] In some other embodiments, the server shown in Figure 6 can be used to execute a data processing method, wherein the processor 602 is specifically used to: obtain the minimum active transaction number of the storage node at at least one historical moment as at least one historical minimum active transaction number; and, at the at least one historical moment, obtain the system sequence number maintained by the storage node as the global transaction commit number corresponding to the at least one historical minimum active transaction number; store the correspondence between the at least one historical active transaction number and its corresponding global transaction commit number in the historical status information of the storage node, so as to perform visibility judgment on the target record on the storage node according to the historical status information and the maximum modification transaction number corresponding to the target record when a distributed query transaction for the target record is received; the target record is in the non-clustered index in the storage node.

[0107]

[0105] Further, as shown in FIG6, the server also includes other components such as a power supply component 604. FIG6 only schematically shows some components, which does not mean that the server only includes the components shown in FIG6.

[0108]

[0106] The memory 601 may be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0109]

[0107] The communication component 603 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as Wi-Fi (wireless network communication technology), 2G (such as Global System for Mobile Communications (GSM)), 3G (such as Wideband Code Division Multiple Access (WCDMA), 4G (such as Long Term Evolution (LTE)), 4G+ (such as upgraded Long Term Evolution (LTE-Advanced, LTE-A)), or 5G (5th Generation Mobile Communication Technology), or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can be based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology, or other similar technologies. ) technology and other technologies to achieve it.

[0110]

[0108] The power supply component 604 is configured to provide power to various components of the device in which the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.

[0111] In this embodiment, a storage node can maintain its historical status information, which stores the correspondence between at least one historical minimum active transaction number and a global transaction commit number on the storage node. Based on this, when a distributed query transaction is initiated for a target record in a non-clustered index, the storage node can use the historical status information to backtrack to the target minimum active transaction number corresponding to the global transaction query number of the query transaction, and then quickly determine whether the target record is visible to the query transaction based on the maximum modification transaction number and the target minimum active transaction number corresponding to the target record. This reduces the frequency of table lookup operations required for visibility determination in non-clustered indexes, significantly reduces query overhead, and improves query efficiency.

[0112]

[0110] Accordingly, an embodiment of the present disclosure further provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be executed by the storage node in the above method embodiment.

[0113]

[0111] Accordingly, an embodiment of the present disclosure further provides a computer program product, including a computer program / instruction. When the computer program / instruction is executed, each step that can be executed by the storage node in the above method embodiment can be implemented.

[0114]

[0112] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM (Compact Disc Read-Only Memory), optical storage, etc.) containing computer-usable program code.

[0115] The present invention is described with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present invention. It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one or more flow processes in the flow chart and / or one or more boxes in the block diagram.

[0116]

[0114] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0117]

[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows in the flowchart and / or one or more blocks in the block diagram.

[0116] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), an input / output interface, a network interface, and a memory.

[0118]

[0117] Memory may include non-permanent memory in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0119]

[0118] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, digital versatile discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0120]

[0119] It should also be noted that the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of other identical elements in the process, method, commodity, or apparatus comprising the element.

[0121]

[0120] The above description is merely an embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may be modified and varied in various ways. Any modification, equivalent substitution, improvement, etc. made within the spirit and principles of the present disclosure shall be included within the scope of the claims of the present disclosure.

Claims

Claims 1. A distributed query method, applicable to any storage node in a distributed database system, comprising: receiving a query transaction for a target record in a non-clustered index; querying historical status information of the target record based on a global transaction query number of the query transaction to obtain a target minimum active transaction number corresponding to the global transaction query number; The historical status information stores a correspondence between at least one historical minimum active transaction number and a global transaction commit number on the storage node; Determine whether the target record is visible to the query transaction based on the maximum modification transaction number and the target minimum active transaction number corresponding to the target record; if the target record is visible to the query transaction, return the target record as the query result.

2. The method according to claim 1, wherein: The method further comprises querying historical status information according to the global transaction query number of the query transaction to obtain a target minimum active transaction number corresponding to the global transaction query number, including: querying, among global transaction commit numbers corresponding to the at least one historical minimum active transaction number, a maximum global transaction commit number that is smaller than the global transaction query number; and using, among the at least one historical minimum active transaction number, the minimum active transaction number corresponding to the maximum global transaction commit number as the target minimum active transaction number.

3. The method according to claim 2, wherein: The historical status information is stored in a queue, and any historical minimum active transaction number and its corresponding global transaction commit number are stored as an element in the queue; Querying, from the global transaction commit numbers corresponding to the at least one historical minimum active transaction number, a maximum global transaction commit number that is smaller than the global transaction query number, includes: starting from the most recently written element in the queue, reading the global transaction commit numbers corresponding to the historical minimum active transaction number one by one, and comparing the read global transaction commit numbers with the global transaction query number until a first global transaction commit number that is smaller than the global transaction query number is found, and using the first global transaction commit number as the maximum global transaction commit number.

4. The method according to any one of claims 1 to 3, further comprising: Obtaining a minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number; and, at the at least one historical moment, obtaining a system sequence number maintained by the storage node, each serving as a global transaction commit number corresponding to the at least one historical minimum active transaction number; The correspondence between the at least one historical active transaction number and its corresponding global transaction commit number is stored in the historical status information of the storage node.

5. The method according to claim 4, wherein: Obtaining a minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number includes: Each time the system sequence number maintained by the storage node is updated, the minimum active transaction number of the storage node corresponding to the update time is obtained as the historical minimum active transaction number corresponding to the update time.

6. The method according to claim 4, wherein: Obtaining the minimum active transaction number of the target record at at least one historical moment as the at least one historical minimum active transaction number includes: when any cycle arrives, obtaining the minimum active transaction number of the target record at the cycle arrival moment as the historical minimum active transaction number corresponding to the cycle arrival moment.

7. The method according to claim 4, further comprising: When the storage node commits any distributed write transaction, if the global transaction commit number of the distributed write transaction is greater than the system sequence number currently maintained by the storage node, the system sequence number currently maintained by the storage node is updated according to the global transaction commit number of the distributed write transaction; Alternatively, when the storage node receives any distributed query transaction, if the global transaction query number of the distributed query transaction is greater than the system sequence number currently maintained by the storage node, the system sequence number currently maintained by the storage node is updated according to the global transaction query number of the distributed query transaction.

8. A data processing method, applicable to any storage node in a distributed database system, comprising: Obtain the minimum active transaction number of the storage node at at least one historical moment as at least one historical minimum active transaction number; and, at the at least one historical moment, obtaining a system sequence number maintained by the storage node, each serving as a global transaction commit number corresponding to the at least one historical minimum active transaction number; The correspondence between the at least one historical active transaction number and its corresponding global transaction commit number is stored in the historical status information of the storage node, so as to be used for determining the visibility of the target record based on the historical status information and the maximum modification transaction number corresponding to the target record when a distributed query transaction for the target record is received; the target record is in a non-clustered index in the storage node.

9. A server, comprising: memory and processor; The memory is used to store one or more computer instructions; The processor is configured to execute the one or more computer instructions to: perform the steps of the method according to any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, it can implement the distributed query method described in any one of claims 1 to 8.

11. A computer program product comprising a computer program / instructions, wherein: When the computer program / instruction is executed by a processor, the distributed query method according to any one of claims 1 to 8 can be implemented.

Citation Information

Patent Citations

  • Data query method, device and system

    CN108090056A

  • Method, apparatus and system for copying data

    CN109358817A

  • Method, device and system for processing distributed transactions in SQL (Structured Query Language) database

    CN114328613A

  • Data visibility judgment method and device, database node and medium

    CN114637738A