Database optimization method and device based on Paas cloud platform, equipment and storage medium
By assigning unique timestamps to each transaction on the Paas cloud platform and using these timestamps in database operations, the challenge of data consistency management in traditional databases in cloud environments is solved, achieving higher data consistency and system stability.
Patent Information
- Application Number
- CN202411483000.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-25
AI Technical Summary
Traditional databases are difficult to meet the needs of large-scale and high availability in cloud environments, especially in data consistency management challenges.
Using a database optimization method based on the Paas cloud platform, data consistency and isolation are achieved by assigning unique timestamps to each transaction and using these timestamps in read and write operations. Specific steps include assigning a timestamp to each transaction, comparing the transaction timestamp with the data item timestamp, deciding on read or write operations, and adopting a conflict resolution strategy in conflict situations.
Through this method, database optimization technology can provide better data consistency guarantee, reduce problems caused by inconsistency, and improve system reliability and stability.
Smart Images

Figure CN119513064A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database optimization, and in particular to a database optimization method, device, equipment and storage medium based on a Paas cloud platform. Background Art
[0002] Database optimization technology emerged to address the challenges and limitations of traditional databases in cloud environments. Traditional databases are usually designed for single-machine or centralized deployment, which makes it difficult to meet the large-scale, high-availability requirements of cloud environments. Database optimization technology combines database system and architecture to tightly integrate database management and deployment with cloud computing and containerization technologies. It uses a distributed architecture and horizontal expansion approach to store and process data on multiple nodes, achieving high scalability and elasticity. At the same time, database optimization technology also provides container-level fault recovery and automatic expansion capabilities, allowing the database to adapt to rapidly changing workloads.
[0003] The core concept of database optimization technology is to manage the database as a service, providing standardized interfaces and tools to facilitate developers to operate and manage the database. It supports multi-tenant and multi-region deployment, and can provide enterprises with flexible data management options. At the same time, database optimization technology is also integrated with container orchestration platforms (such as Kubernetes) to achieve dynamic scheduling and resource allocation of databases. This integration can better utilize the automated management functions provided by the container orchestration platform and further simplify the deployment and management process of the database.
[0004] The shortcoming of traditional database optimization technology is the management of data consistency. Due to factors such as network delays and node failures in a distributed environment, there may be certain delays and inconsistencies between data copies in the database. This may lead to reading outdated or incomplete data in some cases, affecting the correctness and reliability of the application. Summary of the invention
[0005] Purpose of the invention: In view of the above problems, a database optimization method, device, equipment and storage medium based on Paas cloud platform are proposed. Data consistency and isolation are achieved by assigning a unique timestamp to each transaction and using these timestamps in read and write operations. When a transaction reads data, it can only see data that has been committed before the transaction started, which can avoid reading expired data. When multiple transactions write data at the same time, MVCC uses timestamps to ensure that the write operations between them do not interfere with each other, thereby maintaining data consistency. If there is a conflict, MVCC can use some conflict resolution strategies, such as timestamp-based priority to determine the final data write result. By using the MVCC algorithm, database optimization technology can provide better data consistency guarantees and reduce problems caused by inconsistency.
[0006] First, a database optimization method based on the Paas cloud platform is proposed, and the optimization method is used to achieve isolation of read and write operations. The steps are as follows:
[0007] Assign a unique timestamp to each transaction;
[0008] Each transaction starts by recording its own timestamp and comparing it with the timestamp of the data item in the database:
[0009] If the self timestamp is earlier than or equal to the data item timestamp, the transaction performs a read operation to read the data item;
[0010] If the self timestamp is later than the data item timestamp, the transaction performs a write operation.
[0011] In a further embodiment of the first aspect, the process of assigning a unique timestamp to each transaction specifically includes:
[0012] Use distributed clocks to obtain a unified timestamp for the system;
[0013] A globally increasing sequence generator is used to ensure the uniqueness of the timestamp of each transaction.
[0014] In a further embodiment of the first aspect, the process of using a globally increasing sequence generator to ensure the uniqueness of the timestamp of each transaction specifically includes:
[0015] A global incrementing sequence generator is initialized to generate unique and increasing serial numbers; each time a data item is created, a new serial number is obtained through this sequence generator to ensure that each data item has a unique identifier.
[0016] In a further embodiment of the first aspect, when each transaction is created, it obtains the current self-time stamp from the distributed clock and records the self-time stamp as the start time of the transaction;
[0017] Each transaction also defines a read set to store the data items and their values read by the transaction; when each data item is created, it obtains a unique sequence number from the global incrementing sequence generator and records it as the timestamp of the data item.
[0018] In a further embodiment of the first aspect, if the self timestamp is later than the data item timestamp, the transaction performs a write operation; wherein:
[0019] If there are timestamp conflicts among multiple write operations, the conflict resolution strategy is executed: According to the priority rule, transactions with earlier timestamps have higher priority, and write operations are executed first to ensure the correctness and consistency of the write operations.
[0020] In addition, the database optimization method based on the Paas cloud platform proposed in the first aspect of the present invention can realize the distributed management of multiple transactions, which specifically includes the following steps:
[0021] The transaction participating nodes send operation requests to the coordinator, and the coordinator performs coordination operations in the preparation and submission phases;
[0022] In the preparation phase, the transaction participating nodes perform operations and send preparation results to the coordinator, and the coordinator decides whether to commit the transaction based on the consistency check results;
[0023] In the commit phase, the transaction participating nodes perform the final commit operation;
[0024] If a failure occurs, the coordinator triggers failover and data recovery operations.
[0025] In addition, by using a database optimization method based on a Paas cloud platform proposed in the first aspect of the present invention, it is possible to process and recover from abnormal situations in the data reading and writing process, and to process network delays and node failures through fault-tolerant technology and a data replication mechanism, as follows:
[0026] Replicate data to multiple nodes to ensure data consistency and availability;
[0027] When a failure occurs, the system automatically performs failover and data recovery, migrating tasks and data to spare nodes or other available nodes.
[0028] A second aspect of the present invention provides a database read-write operation isolation device, which includes a timestamp allocation module and a comparison module.
[0029] The timestamp assignment module is used to assign a unique timestamp to each transaction; each transaction records its own timestamp at the beginning and compares it with the timestamp of the data item in the database.
[0030] The comparison module is used to compare the transaction's own timestamp with the data item timestamp: if the own timestamp is earlier than or equal to the data item timestamp, the transaction performs a read operation to read the data item; if the own timestamp is later than the data item timestamp, the transaction performs a write operation.
[0031] According to a third aspect of the present invention, an electronic device is provided, comprising a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the database optimization method based on the Paas cloud platform as described in the first aspect is implemented.
[0032] In a fourth aspect of the present invention, a computer-readable storage medium is proposed, which stores at least one executable instruction. When the executable instruction is executed on an electronic device, the electronic device executes the database optimization method based on the Paas cloud platform as described in the first aspect.
[0033] The technical solution proposed in the present invention comprehensively improves the performance, stability and security of the Paas cloud platform in database optimization technical capabilities by improving timestamp allocation, read operation isolation, write operation conflict resolution, distributed transaction management and exception handling and recovery technology.
[0034] Compared with existing technologies, its main advantages are the implementation of precise timestamp allocation and concurrency control mechanisms to ensure data consistency and isolation; the introduction of distributed transaction management and fault tolerance mechanisms to ensure system reliability and fault tolerance; and the automatic failover and data recovery strategies for abnormal situations to improve system stability and data reliability. These innovations enable the Paas cloud platform to efficiently manage databases in a distributed environment, provide reliable data services, and bring all-round empowerment to applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of a database optimization method based on Paas cloud platform in an embodiment of the present invention.
[0036] Figure 2 It is a schematic diagram of the structure of a database read-write operation isolation device in an embodiment of the present invention.
[0037] Figure 3 Schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is apparent to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features known in the art are not described.
[0039] Embodiment 1:
[0040] The embodiment of the present invention provides a solution to the problem of data consistency in database optimization technology. Figure 1 The database optimization technology based on the Paas cloud platform can adopt the following five solutions. There is a progressive relationship between these solutions, which gradually improve the management of data consistency. They mainly include: timestamp allocation, read operation isolation, write operation conflict resolution, distributed transaction management, exception handling and recovery.
[0041] S101: Timestamp allocation
[0042] The timestamp allocation process of this patent uses a distributed clock or a globally increasing sequence generator to assign a unique timestamp to each transaction. The distributed clock ensures the time synchronization between nodes to ensure the accuracy of the timestamp. The globally increasing sequence generator ensures the uniqueness of each timestamp to avoid conflicts and duplications. Through timestamp allocation, each transaction can obtain a unique identifier to ensure the order and consistency of transactions.
[0043] S102: Read Operation Isolation
[0044] The read operation isolation process of this patent ensures that the data read by the transaction is the version that meets the requirements. Each transaction records its own timestamp at the beginning and compares it with the timestamp of the data item in the database. The transaction can read the data item only if the timestamp is earlier than or equal to the timestamp of the data item. This method avoids reading expired or invalid data. Concurrency control strategies such as read-write locks or optimistic concurrency control are used to ensure the isolation and consistency of read operations.
[0045] S103: Write operation conflict resolution
[0046] The write conflict resolution process of this patent handles conflicts of concurrent writes. Each transaction is assigned a timestamp and compared with the timestamp of the corresponding data item in the database. If the timestamp of the transaction is later than the timestamp of the data item, the transaction can perform the write operation. If the timestamp conflicts, a conflict resolution strategy is adopted, such as a strategy based on timestamp priority. According to the priority rule, the transaction with an earlier timestamp has a higher priority and the write operation is performed first to ensure the correctness and consistency of the write operation.
[0047] S104: Distributed Transaction Management
[0048] The distributed transaction management process of this patent manages the coordination and execution of transactions through the coordinator node. The transaction participating nodes send operation requests to the coordinator, and the coordinator performs coordination operations in the preparation and submission phases. In the preparation phase, the participating nodes perform operations and send the preparation results to the coordinator. The coordinator decides whether to submit the transaction based on the consistency check results. In the submission phase, the participating nodes perform the final submission operation. If a failure occurs, the coordinator triggers failover and data recovery operations to ensure the consistency and reliability of distributed transactions.
[0049] S105: Exception handling and recovery
[0050] The exception handling and recovery process of this patent uses fault-tolerant technology and data replication mechanism to handle abnormal situations such as network delays and node failures. Fault-tolerant technology includes redundant backup and fault detection and recovery mechanism to ensure the reliability and consistency of the system. The data replication mechanism ensures data consistency and availability by replicating data to multiple nodes. In the event of a failure, the system will automatically perform failover and data recovery, migrating tasks and data to spare nodes or other available nodes to ensure system continuity and data integrity.
[0051] Embodiment 2:
[0052] This embodiment discloses the specific details of timestamp allocation based on Embodiment 1:
[0053] Assign a unique timestamp to each transaction to ensure the order and consistency between transactions. The timestamp can be used to sort the read and write operations of transactions to avoid reading expired or invalid data.
[0054] Assigning a unique timestamp to each transaction is a key technical means to ensure the order and consistency between transactions in database optimization technology. Through timestamps, the read and write operations of transactions can be sorted to avoid reading expired or invalid data. In practice, this process involves detailed steps and related technologies in multiple aspects to ensure the correctness and reliability of data.
[0055] First, the allocation of timestamps needs to ensure that each transaction has a unique identifier. This can be achieved by using distributed clocks or a globally increasing sequence generator. Distributed clocks can synchronize time between nodes to ensure the accuracy of timestamps. A globally increasing sequence generator can ensure that each transaction is assigned a unique timestamp to avoid conflicts and duplications.
[0056] During the read operation, the timestamp is used to determine the data version read by the transaction. Each transaction records its own timestamp at the beginning and compares it with the timestamp of the data item in the database. The transaction can read the data item only if the timestamp is earlier than or equal to the timestamp of the data item. This method can avoid reading expired or invalid data. In addition, concurrency control strategies such as read-write locks or optimistic concurrency control are used to ensure the isolation and consistency of read operations.
[0057] In terms of database write operations, the application of timestamps is to resolve conflicts in concurrent writes. Each transaction is assigned a timestamp and compared with the timestamp of the corresponding data item in the database. If the timestamp of the transaction is later than the timestamp of the data item, the transaction can proceed with the write operation. If there is a timestamp conflict, a conflict resolution strategy may be required to determine the final write result, such as a strategy based on timestamp priority. This can ensure the correctness and consistency of the write operation.
[0058] Database optimization technology can ensure data consistency through timestamp allocation, read operation isolation, and write operation conflict resolution. By assigning a unique timestamp to each transaction and strictly sorting and comparing based on the timestamp, it is possible to avoid reading expired or invalid data while ensuring the correctness of concurrent write operations. This is crucial for distributed database optimization technology in cloud environments, reducing the problems caused by data inconsistency and improving system reliability and stability.
[0059] In the Paas cloud platform scenario, the Python programming language can be improved to improve the stability and security of the system. Here are some improvements: Introduce distributed clocks or globally increasing sequence generators: When assigning timestamps, use distributed clocks or globally increasing sequence generators to ensure that each transaction has a unique identifier. This avoids conflicts and duplications and ensures the accuracy of timestamps. Adopt read-write locks or optimistic concurrency control strategies: During read operations, introduce concurrency control strategies such as read-write locks or optimistic concurrency control to ensure the isolation and consistency of read operations. This prevents reading expired or invalid data.
[0060] Conflict resolution strategy: For write operations, when the timestamp of a transaction conflicts with the timestamp of a data item, a conflict resolution strategy is needed to determine the final write result. A strategy based on timestamp priority can be considered to ensure the correctness and consistency of the write operation.
[0061] A distributed clock and a globally increasing sequence generator are introduced. The role of the distributed clock is to provide a unified timestamp, while the globally increasing sequence generator is used to ensure the uniqueness and order of each timestamp. These two components work together to assign unique and increasing timestamps to each transaction and data item, avoiding timestamp conflicts and duplications.
[0062] Next, a transaction class is defined. When each transaction is created, it obtains the current timestamp and initializes two sets: one for storing the data items to be read and their values, and the other for storing the data items to be written and their new values. In a read operation, the transaction checks whether the timestamp of the data item is earlier than the timestamp of the transaction. If so, it means that the data item has not been updated, and the transaction can read its value and record it in the read set. If the timestamp of the data item is later than the timestamp of the transaction, it means that the data item has been updated, and the transaction needs to re-read the data item to ensure that the latest data is read.
[0063] In a write operation, the transaction will first check whether the timestamp of the data item is earlier than the timestamp of the transaction. If so, it means that the data item has not been updated by other transactions, and the transaction can safely write the new value and record it in the write set. If the timestamp of the data item is later than the timestamp of the transaction, it means that there is a write conflict. At this time, the transaction will obtain other transactions that are writing the data item and compare the timestamps of the two transactions. If the timestamp of the current transaction is newer, it will overwrite the write of the older transaction; otherwise, the current transaction must abandon the write operation because the write conflict cannot be resolved.
[0064] When a transaction is ready to commit, it writes all data items and corresponding new values in the write set to the database, and updates the timestamp of the data item to the timestamp of the transaction. This process ensures the consistency and correctness of the data, because only transactions with newer timestamps can overwrite the writes of transactions with older timestamps.
[0065] In order to implement the read and write operations of data items, a data item class is also defined. When a data item is created, it will obtain a unique timestamp through the global incrementing sequence generator and initialize its value. In the write operation, the timestamp of the data item will be updated to the timestamp of the transaction to record the latest write operation. In this way, subsequent read and write operations can determine whether the data item has been updated by comparing the timestamp, thereby ensuring data consistency.
[0066] The introduction of distributed clocks and a global increasing sequence generator solves the problem of timestamp conflicts and duplications, ensuring that the timestamps of each transaction and data item are unique and increasing. At the same time, by adopting concurrency control strategies such as read-write locks or optimistic concurrency control, the isolation and consistency of read operations are guaranteed. For write operations, a conflict resolution strategy is introduced to handle conflicts in concurrent write operations by comparing the timestamps of transactions to decide whether to overwrite older writes. These strategies work together to improve the reliability and stability of the system and reduce the problems caused by data inconsistency.
[0067] In a distributed environment, this section shows how to use timestamps to manage data consistency. Through a unified timestamp mechanism, all read and write operations can be sorted on a unified timeline, thus avoiding data consistency issues caused by concurrent operations. Even in a high-concurrency environment, through reasonable concurrency control and conflict resolution strategies, the system can still maintain efficient operation and ensure data correctness.
[0068] Paas platforms usually need to handle a large number of concurrent requests and distributed data storage, and the timestamp mechanism and concurrency control strategy can effectively manage these complex operations. In addition, through the conflict resolution strategy, the system can make reasonable decisions when facing write operation conflicts, thereby ensuring data consistency.
[0069] The introduction of distributed clocks and global incrementing sequence generators enables the system to generate unique and incrementing timestamps in a distributed environment, avoiding timestamp conflicts and duplications. Through a reasonable concurrency control strategy, the system can ensure the isolation and consistency of read operations, avoiding data inconsistency problems caused by concurrent read and write operations. The conflict resolution strategy provides an effective solution to write operation conflicts, ensuring the correctness and consistency of write operations.
[0070] The allocation and application of timestamps is an important means to solve data consistency problems in database optimization technology. Through the accurate allocation and effective use of timestamps, the order and consistency between transactions can be ensured, and outdated or invalid data can be avoided. The application of this technology in cloud environments is of great significance, which can improve the accuracy and reliability of data management and provide stable and consistent data access capabilities for applications.
[0071] Embodiment 3:
[0072] This embodiment discloses the specific details of read operation isolation based on Embodiment 1:
[0073] In the read operation, the timestamp at the start of the transaction is used as a reference, and only data that has been committed before the timestamp is allowed to be read. This can avoid reading uncommitted or expired data and improve data consistency.
[0074] In database optimization technology, in order to improve data consistency, the read operation uses the timestamp at the start of the transaction as a reference, and only allows reading data that has been committed before the timestamp. This mechanism effectively avoids reading uncommitted or expired data, ensuring data consistency and reliability. The specific implementation process involves detailed steps and related technologies in multiple aspects.
[0075] First, each transaction is assigned a unique timestamp at the beginning, which can be generated by a distributed clock or a globally increasing sequence generator. Distributed clocks can ensure time synchronization between nodes, thereby ensuring the accuracy of timestamps. Globally increasing sequence generators ensure the uniqueness of each timestamp to avoid conflicts and duplications.
[0076] During the read operation, the transaction records the timestamp when it starts and compares it with the timestamp of the data item in the database. If the timestamp of the data item is earlier than or equal to the timestamp of the transaction, the transaction can read the data item. In this way, only the data that has been committed before the transaction starts can be read, avoiding the situation of reading uncommitted or expired data. By comparing the timestamps, the transaction can effectively filter out the data version that meets the requirements and ensure that the read data is consistent.
[0077] To support the consistency of read operations, databases usually maintain a timestamp or version number for each data item. When a transaction initiates a read operation, the database compares the transaction timestamp with the data item timestamp to determine the data version that can be read. If the timestamp of the data item is later than the timestamp of the transaction, the data item may have been updated, and the transaction needs to take appropriate actions based on the consistency requirements, such as waiting for the update of the data item to be completed or selecting other available data versions.
[0078] The introduction of distributed clocks and global incrementing sequence generators can assign unique timestamps to ensure data consistency. The specific implementation process is as follows.
[0079] First, the system obtains a unified timestamp through distributed clock initialization. The role of distributed clocks is to assign a unique timestamp to each transaction and data item to ensure the uniqueness and accuracy of the timestamp. This mechanism can effectively avoid timestamp conflicts and duplications, thereby ensuring that the timestamp of each transaction is unique and incremental.
[0080] Next, a global incrementing sequence generator is initialized to generate unique and increasing serial numbers. Each time a data item is created, a new serial number is obtained through this sequence generator to ensure that each data item has a unique identifier. This serial number not only ensures the uniqueness of the data item, but also enables the system to sort and manage the data items in the order of the serial number.
[0081] Then, a transaction class is defined. When each transaction is created, it obtains the current timestamp from the distributed clock and records this timestamp as the start time of the transaction. This timestamp is used in subsequent read operations to determine whether the data item has been committed before the transaction starts. The transaction class also defines a read collection to store the data items and their values read by the transaction.
[0082] In a read operation, a transaction first compares the timestamp of a data item with its own timestamp. Only when the timestamp of a data item is earlier than or equal to the timestamp of the transaction, the transaction is allowed to read the value of the data item. This is to ensure that a transaction can only read data that has been committed before it starts, and avoid reading uncommitted or expired data. This timestamp comparison mechanism can effectively ensure the consistency of read operations and improve the data consistency and reliability of the system.
[0083] At the same time, a data item class is also defined. When each data item is created, it will obtain a unique serial number from the global incrementing sequence generator and record it as the timestamp of the data item. The value of the data item is also initialized when it is created. In subsequent read and write operations, the timestamp of the data item will be used as the basis for determining the version of the data item, ensuring that each read and write operation can obtain the latest data.
[0084] The introduction of distributed clocks and global incrementing sequence generators ensures that the timestamps of each transaction and data item are unique and incrementing, thus avoiding timestamp conflicts and duplications. Through a reasonable timestamp comparison mechanism, transactions can filter out data versions that meet the requirements, thereby achieving consistency in read operations. Each transaction can only read data that has been committed before it starts, avoiding reading uncommitted or expired data, thereby improving the data consistency and reliability of the system.
[0085] In a distributed environment, data consistency is an important challenge. Through a unified timestamp mechanism, all read and write operations can be sorted on a unified timeline, thus avoiding data consistency issues caused by concurrent operations. Even in a high-concurrency environment, through a reasonable timestamp comparison mechanism, the system can still maintain efficient operation and ensure data correctness.
[0086] Specifically for Paas cloud platform, this design can adapt well to the distributed architecture in cloud environment. Paas platform usually needs to handle a large number of concurrent requests and distributed data storage, and the timestamp mechanism and timestamp comparison mechanism can effectively manage these complex operations. In addition, through the timestamp comparison mechanism, the system can make reasonable decisions when facing write operation conflicts, thereby ensuring data consistency.
[0087] By introducing distributed clocks and a global incremental sequence generator, the system can generate unique and incremental timestamps in a distributed environment, avoiding timestamp conflicts and duplications. Through a reasonable timestamp comparison mechanism, the system can ensure the consistency of read operations and avoid data inconsistency problems caused by concurrent read and write operations. The application of these technologies not only improves system performance, but also provides developers with a more robust and reliable data management solution.
[0088] In addition, isolation and concurrency control of read operations are also important means to ensure data consistency. By adopting appropriate concurrency control strategies, such as read-write locks or optimistic concurrency control, isolation and data consistency between concurrent read operations can be ensured. These concurrency control strategies determine read-write conflicts based on transaction timestamps and take corresponding measures to ensure data consistency. For example, read-write locks can ensure mutual exclusion between read and write operations to prevent read operations from reading uncommitted data. Optimistic concurrency control uses version numbers or timestamps to determine whether data has been modified, thereby deciding whether to allow read operations.
[0089] These concurrency control strategies further improve the data consistency and reliability of the system based on the timestamp mechanism. In a high-concurrency environment, through reasonable concurrency control strategies, the system can effectively manage concurrent read and write operations to ensure that each read operation can obtain the latest and correct data. At the same time, through the combination of the timestamp mechanism and the concurrency control strategy, the system can make reasonable decisions when facing write operation conflicts, thereby ensuring data consistency.
[0090] Through the timestamp mechanism, global increment sequence generator, timestamp comparison mechanism and concurrency control strategy, the consistency and correctness of data are ensured, and the stability and security of the system are improved. These improvements make it more suitable for running in the Paas cloud platform, able to handle the database optimization technology requirements in complex distributed environments, and ensure data consistency and reliability. The application of these technologies provides a robust and efficient data management solution for the Paas cloud platform, enabling the system to run efficiently in high-concurrency and distributed environments, ensuring the correctness and consistency of data.
[0091] By using the timestamp at the start of the transaction as a reference, database optimization technology ensures data consistency in read operations. By comparing timestamps and applying concurrency control strategies, only data that has been committed before the start of the transaction is allowed to be read, avoiding the situation of reading uncommitted or expired data. This can ensure the accuracy and reliability of read operations and improve data consistency. This is of great significance for the application of database optimization technology, ensuring that applications can obtain a consistent view when reading data and avoiding problems caused by data inconsistency.
[0092] Embodiment 4:
[0093] This embodiment discloses the specific details of writing operation conflict resolution based on Embodiment 1:
[0094] When multiple transactions write data at the same time, timestamps are used to ensure that their write operations do not interfere with each other. Conflict resolution strategies, such as timestamp-based priority, are used to determine the final data writing result and maintain data consistency.
[0095] In database optimization technology, when multiple transactions write data at the same time, timestamps are used to ensure that the write operations between them do not interfere with each other to maintain data consistency. At the same time, conflict resolution strategies, such as timestamp-based priority, are used to determine the final data writing result. The implementation of this mechanism involves multiple detailed steps and related technologies to ensure the correctness of concurrent write operations and data consistency.
[0096] First, each transaction is assigned a unique timestamp to ensure that each transaction is written in order. These timestamps can be generated by distributed clocks or globally increasing sequence generators. Distributed clocks ensure the time synchronization of each node and the accuracy of timestamps; globally increasing sequence generators ensure the uniqueness of each timestamp to avoid conflicts and duplications.
[0097] During the write operation, each transaction will compare its own timestamp with the timestamp of the corresponding data item in the database. If the timestamp of the transaction is later than the timestamp of the data item, it means that the write operation of the transaction is legal and the write operation can be performed. If the timestamps conflict, that is, the timestamps of multiple transactions intersect with each other, then a conflict resolution strategy is needed to determine the final data write result.
[0098] One common conflict resolution strategy is based on the priority of timestamps. Based on the order of timestamps, transactions can decide whether to continue to perform write operations according to the priority rules. For example, transactions with earlier timestamps can have higher priority and perform write operations first, while transactions with later timestamps need to wait for the completion of conflicting transactions. This ensures the orderliness of write operations, avoids interference between concurrent write operations, and maintains data consistency.
[0099] In addition, other conflict resolution strategies can be used, such as first come, first serve or weight distribution. These strategies are based on the order and priority of timestamps to ensure that concurrent write operations can be performed according to certain rules, thereby maintaining data consistency.
[0100] The introduction of distributed clocks and global increasing sequence generators ensures that each transaction and data item has a unique and increasing timestamp, thereby achieving orderliness and consistency in data operations. The specific implementation process is as follows:
[0101] First, the system obtains a unified timestamp through distributed clock initialization. The role of distributed clocks is to assign a unique timestamp to each transaction and data item to ensure the uniqueness and accuracy of the timestamp. This mechanism can effectively avoid timestamp conflicts and duplications, thereby ensuring that the timestamp of each transaction is unique and incremental.
[0102] Next, a global incrementing sequence generator is initialized to generate unique and increasing serial numbers. Each time a data item is created, a new serial number is obtained through this sequence generator to ensure that each data item has a unique identifier. This serial number not only ensures the uniqueness of the data item, but also enables the system to sort and manage the data items in the order of the serial number.
[0103] Then, a transaction class is defined. When each transaction is created, it obtains the current timestamp from the distributed clock and records this timestamp as the start time of the transaction. This timestamp is used in subsequent write operations to determine whether the data item has been updated before the transaction starts. The transaction class also defines a write set to store the data items to be written by the transaction and their new values.
[0104] In a write operation, a transaction first compares the timestamp of the data item with its own timestamp. Only when the timestamp of the data item is earlier than the timestamp of the transaction, the transaction is allowed to write the new value to the data item and record the data item in the write set. If the timestamp of the data item is later than the timestamp of the transaction, it indicates a write conflict. At this point, the transaction obtains other transactions that are writing to the data item and compares the timestamps of the two transactions. If the timestamp of the current transaction is newer, the write of the older transaction is overwritten; otherwise, the current transaction must abandon the write operation because the write conflict cannot be resolved.
[0105] When a transaction is ready to commit, it writes all data items and corresponding new values in the write set to the database, and updates the timestamp of the data item to the timestamp of the transaction. This process ensures the consistency and correctness of the data, because only transactions with newer timestamps can overwrite the writes of transactions with older timestamps.
[0106] In order to implement the read and write operations of data items, a data item class is also defined. When a data item is created, it will obtain a unique timestamp through the global incrementing sequence generator and initialize its value and transaction information. In the write operation, the timestamp of the data item will be updated to the timestamp of the transaction, and the transaction currently performing the write operation will be recorded. In this way, subsequent write operations can determine whether writing is allowed by comparing the timestamp, thereby ensuring data consistency.
[0107] This code solves the problem of timestamp conflicts and duplications by introducing distributed clocks and a global increasing sequence generator, ensuring that the timestamps of each transaction and data item are unique and increasing. At the same time, through a reasonable timestamp comparison mechanism, transactions can filter out data versions that meet the requirements, thereby achieving consistency in concurrent write operations. Each transaction can only write data that has not been updated before it starts, avoiding data inconsistency caused by concurrent write operations, thereby improving the data consistency and reliability of the system.
[0108] In a distributed environment, data consistency is an important challenge. Through a unified timestamp mechanism, all read and write operations can be sorted on a unified timeline, thus avoiding data consistency issues caused by concurrent operations. Even in a high-concurrency environment, through a reasonable timestamp comparison mechanism, the system can still maintain efficient operation and ensure data correctness.
[0109] Specifically for Paas cloud platform, the design of this code can adapt well to the distributed architecture in cloud environment. Paas platform usually needs to handle a large number of concurrent requests and distributed data storage, and the timestamp mechanism and timestamp comparison mechanism can effectively manage these complex operations. In addition, through the timestamp comparison mechanism, the system can make reasonable decisions when facing write operation conflicts, thereby ensuring data consistency.
[0110] By introducing distributed clocks and a global incrementing sequence generator, the system can generate unique and incrementing timestamps in a distributed environment, avoiding timestamp conflicts and duplications. Through a reasonable timestamp comparison mechanism, the system can ensure the consistency of concurrent write operations, avoiding data inconsistency problems caused by concurrent write operations. The application of these technologies not only improves system performance, but also provides developers with a more robust and reliable data management solution.
[0111] In addition, isolation and conflict resolution strategies for concurrent write operations are also important means to ensure data consistency. By adopting appropriate conflict resolution strategies, such as strategies based on timestamp priority, the correctness and data consistency between concurrent write operations can be ensured. These conflict resolution strategies determine write conflicts based on transaction timestamps and take corresponding measures to ensure data consistency. For example, strategies based on timestamp priority can ensure that transactions with earlier timestamps have higher priorities and execute write operations first, thereby ensuring the orderliness of data writing.
[0112] These conflict resolution strategies further improve the data consistency and reliability of the system based on the timestamp mechanism. In a high-concurrency environment, through reasonable conflict resolution strategies, the system can effectively manage concurrent write operations, ensuring that each write operation can be executed correctly and will not interfere with each other. At the same time, through the combination of the timestamp mechanism and the conflict resolution strategy, the system can make reasonable decisions when facing write operation conflicts, thereby ensuring data consistency.
[0113] By using timestamps and conflict resolution strategies, database optimization technology can ensure the correct execution of concurrent write operations and data consistency. Each transaction performs write operations according to the order of timestamps, and the conflict resolution strategy ensures the order and priority of write operations and avoids mutual interference between write operations. This is very important for distributed database optimization technology in cloud environments to ensure that concurrent write operations can be executed correctly and guarantee data consistency and reliability.
[0114] Embodiment 5:
[0115] This embodiment discloses the specific details of distributed transaction management based on Embodiment 1:
[0116] The distributed transaction management mechanism is introduced to ensure the atomicity, consistency, isolation and persistence of transaction operations between multiple database nodes. Global data consistency is achieved by coordinating the transaction submission and rollback of each node.
[0117] In database optimization technology, the introduction of distributed transaction management mechanism is to ensure that transaction operations between multiple database nodes are atomic, consistent, isolated and durable. Global data consistency is achieved by coordinating transaction commits and rollbacks of each node. This mechanism involves multiple detailed steps and related technologies, aiming to ensure the correct execution of transactions and the reliability of data in a distributed environment.
[0118] This patent innovatively introduces an improved method based on MVCC (Multi-Version Concurrency Control) to improve the efficiency and consistency of distributed transaction management. During the execution of distributed transactions, through the MVCC mechanism, the read and write operations of the transaction can achieve better concurrency control and isolation.
[0119] First, in terms of read operation isolation, the MVCC method is used to determine the data version read by the transaction. Each transaction records its own timestamp at the beginning and compares it with the timestamp of the data item in the database. The transaction can only read the data item if the timestamp is earlier than or equal to the timestamp of the data item. The MVCC mechanism avoids reading expired or invalid data, ensuring the isolation and consistency of read operations.
[0120] In terms of conflict resolution for write operations, the MVCC strategy is introduced to resolve conflicts in concurrent writes. Each transaction is assigned a timestamp and compared with the timestamp of the corresponding data item in the database. If the timestamp of the transaction is later than the timestamp of the data item, the transaction can perform the write operation. If the timestamps conflict, the final write result is determined according to the MVCC priority rules. Transactions with earlier timestamps have higher priority and are written first to ensure the correctness and consistency of the write operation.
[0121] The introduction of multi-version concurrency control (MVCC) technology ensures the isolation and consistency of read and write operations and improves the performance and concurrent processing capabilities of the system. The following is a detailed description of the specific implementation process and related technologies.
[0122] First, through the distributed clock initialization, the system can obtain a unified timestamp. The role of the distributed clock is to assign a unique and increasing timestamp to each transaction and data item, thereby avoiding timestamp conflicts and duplications. The global increasing sequence generator is used to generate unique and increasing sequence numbers to ensure that each transaction and data item has a unique identifier. Each time a transaction or data item is created, a new sequence number is obtained through the sequence generator so that the system can sort and manage transactions and data items in the order of the sequence numbers.
[0123] In order to implement multi-version concurrency control (MVCC), a transaction class and a data item class are defined. When each transaction is created, it obtains the current timestamp from the distributed clock and records this timestamp as the start time of the transaction. This timestamp is used in subsequent read and write operations to determine whether the version of the data item has been updated before the transaction starts. The transaction class defines a read set and a write set to store the data items and their versions read and written by the transaction.
[0124] In a read operation, the transaction first checks whether the data item is in the write set. If the data item is not in the write set, it means that the transaction has not modified the data item. At this time, the transaction will compare the timestamp of the data item with its own timestamp. If the timestamp of the data item is earlier than or equal to the timestamp of the transaction, it means that the data item already existed before the transaction started and was not updated. The transaction can read the latest version and record it in the read set. If the timestamp of the data item is later than the timestamp of the transaction, it means that the data item has been updated by other transactions. The current transaction needs to re-read the data item to ensure that the latest data is read.
[0125] In a write operation, the transaction will first check whether the timestamp of the data item is earlier than or equal to the timestamp of the transaction. If the timestamp of the data item is earlier than or equal to the timestamp of the transaction, it means that the data item already existed before the transaction started and was not updated. The transaction can create a new version of the data item and record it in the write set. If the timestamp of the data item is later than the timestamp of the transaction, it means that the data item has been updated by other transactions. The current transaction cannot perform a write operation because it will cause data inconsistency.
[0126] When a transaction is ready to commit, it adds all data item versions in the write set to the database and updates the timestamp of the data item to the timestamp of the transaction. This process ensures data consistency and correctness, because only transactions with newer timestamps can overwrite the writes of transactions with older timestamps. After the commit operation is completed, the transaction adds the data item version it wrote to the version list of the data item so that subsequent transactions can read the latest data.
[0127] In order to implement the read and write operations of data items, a data item class is also defined. When a data item is created, it will obtain a unique timestamp through the global incrementing sequence generator and initialize its value and version list. Each data item contains a version list, which is used to store different versions of data items. Each version of the data item consists of a timestamp and a value. The timestamp records the creation time of the data item, and the value records the specific content of the data item. In the write operation, the data item will create a new version and add it to the version list. In this way, subsequent read and write operations can determine whether to allow reading and writing by comparing the timestamp, thereby ensuring data consistency.
[0128] In order to implement the distributed transaction management mechanism, a coordinator class and a participating node class are defined. The coordinator is responsible for coordinating the commit and rollback of transactions. The participating nodes perform the prepare, commit and rollback operations and notify the coordinator of the results. The coordinator class contains the transaction ID, the participating node set, the participating node set that successfully prepared, the participating node set that successfully committed, and the participating node set that successfully rolled back. At the beginning of a transaction, the coordinator obtains a unique transaction ID from the global incrementing sequence generator and records it as the ID of the current transaction.
[0129] During the preparation phase, the coordinator sends a prepare request to all participating nodes and waits for responses from the participating nodes. After receiving the prepare request, the participating nodes try to acquire the lock of the data item and perform the prepare operation. If all participating nodes are successfully prepared, the coordinator sends a commit request to all participating nodes and waits for the commit result. If any participating node fails to prepare, the coordinator sends a rollback request to all participating nodes and waits for the rollback result. During the commit or rollback phase, the coordinator records the participating nodes that have successfully committed or rolled back based on the response results of the participating nodes.
[0130] After receiving the prepare request, the participating node will try to acquire the lock of the data item. If the lock is successfully acquired, the preparation is successful; otherwise, the preparation is failed. In the commit phase, the participating node releases the lock and performs the commit operation. In the rollback phase, the participating node releases the lock and performs the rollback operation. The participating node interacts with the coordinator through the interface provided by the coordinator and notifies the coordinator of the results of the prepare, commit, and rollback.
[0131] In order to ensure the isolation and consistency of concurrent operations, the coordinator also implements a lock mechanism. The coordinator maintains a lock table to record the lock status of each data item. During the preparation phase, when a participating node attempts to acquire the lock of a data item, it sends a lock request to the coordinator. After receiving the lock request, the coordinator checks the lock status of the data item. If the data item is not locked, the lock is granted to the participating node and the lock table is updated. If the data item is locked, the lock failure is returned. During the commit or rollback phase, the participating node sends an unlock request to the coordinator. After receiving the unlock request, the coordinator releases the lock of the data item and updates the lock table.
[0132] By introducing MVCC, multi-version concurrency control, distributed transaction management and locking mechanisms, this code ensures the atomicity, consistency, isolation and durability of transaction operations. When each transaction performs read and write operations, it will determine the version of the data item based on the timestamp, thereby avoiding reading data that has been modified by other transactions and ensuring data consistency. The coordinator is responsible for coordinating and managing the execution order of transactions. Participating nodes will try to obtain locks on data items before executing transaction operations to ensure isolation and consistency between transactions. The introduction of the locking mechanism avoids conflicts in concurrent write operations, thereby improving the performance and stability of the system.
[0133] In the Paas cloud platform scenario, these improvements can effectively handle transaction management requirements in a distributed environment, ensuring the correct execution of transactions and the reliability of data. The application of these technologies not only improves the performance of the system, but also provides developers with a more robust and reliable data management solution that adapts to the needs of the Paas cloud platform and ensures data consistency and reliability. Through a reasonable timestamp mechanism, concurrency control, and lock mechanism, the system can run efficiently in a distributed environment, ensuring the correctness and consistency of data operations, and providing stable, high-performance data services for business systems.
[0134] Compared with the original technology, the improvement of this section is: the introduction of MVCC technology, creating different versions of data items for each transaction, achieving isolation and consistency between transactions. The structure and logic are improved, and the stability and security of the system are improved. Through these improvements, the concurrent transaction requirements in the distributed environment can be handled in the Paas cloud platform, ensuring the correct execution of transactions and the reliability of data.
[0135] Embodiment 6:
[0136] This embodiment discloses the specific details of exception handling and recovery based on Embodiment 1:
[0137] Implement corresponding exception handling strategies and fault recovery mechanisms for abnormal situations such as network delays and node failures. For example, adopt fault-tolerant technology and data replication mechanisms to ensure consistency between data copies and perform automatic failover and data recovery after node failures.
[0138] In database optimization technology, corresponding exception handling strategies and fault recovery mechanisms are implemented for abnormal situations such as network delays and node failures to ensure system reliability and data consistency. This mechanism includes the use of fault-tolerant technology and data replication mechanisms, as well as automatic failover and data recovery strategies. Through these measures, the system can quickly recover under abnormal circumstances to ensure data integrity and availability.
[0139] First of all, fault tolerance technology is one of the key measures in database optimization technology. By adopting fault tolerance technology, the system can maintain normal operation in the event of node failure or other abnormal situations. Common fault tolerance technologies include redundant backup and fault detection and recovery mechanism. Redundant backup ensures data reliability and consistency by saving copies of data on different nodes. When a node fails, data can be obtained from the backup node to achieve failover and data recovery. At the same time, the fault detection and recovery mechanism can detect node failures in a timely manner and trigger corresponding recovery operations, such as reallocating tasks or starting standby nodes.
[0140] Secondly, the data replication mechanism is an important means to ensure data consistency and availability. By replicating data to multiple nodes, the system can still provide reliable data access in the event of node failure or network anomalies. Data replication can be done in synchronous replication or asynchronous replication. In synchronous replication, all write operations must be completed on all replicas before returning success, ensuring strong data consistency. In asynchronous replication, write operations only need to complete writing on the primary node to return success, and then asynchronously replicate the data to other replicas, providing higher performance and availability.
[0141] Automatic failover and data recovery for node failures are important components of database optimization technology. When a node fails, the system needs to automatically transfer tasks and data on the failed node to other available nodes. This can be achieved by using a cluster manager or an automatic fault detection mechanism. Once the failed node is detected, the system will immediately start the failover process and migrate tasks and data to the backup node or other available nodes to ensure service continuity and data consistency. At the same time, data recovery is also an important part of failover. After a node fails, the system will automatically restore data from the backup copy to the new node to ensure data integrity and availability.
[0142] Embodiment 7:
[0143] This embodiment discloses a database read-write operation isolation device 600. Figure 2 . The device includes two parts: a timestamp allocation module 601 and a comparison module 602. The timestamp allocation module 601 is used to allocate a unique timestamp to each transaction; each transaction records its own timestamp at the beginning and compares it with the data item timestamp in the database. The comparison module 602 is used to compare the transaction's own timestamp with the data item timestamp: if the own timestamp is earlier than or equal to the data item timestamp, the transaction performs a read operation to read the data item; if the own timestamp is later than the data item timestamp, the transaction performs a write operation.
[0144] The database read-write operation isolation device 600 can automatically execute the details disclosed in the above-mentioned embodiments 1 to 4, which will not be repeated here.
[0145] Figure 3 The internal structure diagram of the electronic device. The electronic device includes a processor, a memory, a communication interface and a communication bus. The processor, the memory and the communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which enables the processor to execute Figure 1 The running steps of the database optimization method in .
[0146] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication may be performed through an input / output (I / O) interface. In addition, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0147] This embodiment also provides a computer-readable storage medium, in which at least one executable instruction is stored, and when the executable instruction is executed on an electronic device, the electronic device performs the operation of the database optimization method described in the above embodiment. More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0148] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, which carry readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0149] In summary, the database optimization technology based on the Paas cloud platform disclosed in the present invention solves the problems of high concurrent access, data consistency and reliability for the business needs in a distributed environment. By improving timestamp allocation, read operation isolation, write operation conflict resolution, distributed transaction management, and exception handling and recovery technology, efficient management and protection of data is achieved, ensuring that the business system can run safely and reliably in a distributed environment. The core protection point of this patent is to improve timestamp allocation, read operation isolation, write operation conflict resolution, distributed transaction management, exception handling and recovery technology to jointly realize the full empowerment of the Paas cloud platform in database optimization technology capabilities, which has the effect of increasing its performance, stability and security. Simple functional design is also a protection point of this patent. As well as page design, there are also related technical parameter configurations that are the technical points that this patent wants to protect, as well as the technical support provided for the cloud base.
[0150] The database optimization technology based on Paas cloud platform disclosed in the present invention can be applied to various application scenarios, such as large-scale online transaction systems, real-time data analysis platforms and Internet of Things applications. It can meet the requirements of business systems for high performance, high concurrency, data consistency and reliability, while supporting elastic expansion and fault tolerance mechanisms, and providing reliable data management and services for application systems.
[0151] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not 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 specification. Although the present invention has been represented and described with reference to specific preferred embodiments, it shall not be interpreted as a limitation of the present invention itself. Various changes can be made to it in form and detail without departing from the spirit and scope of the present invention defined in the attached claims.
Claims
1. A database optimization method based on Paas cloud platform, used to achieve isolation of read and write operations; characterized in that: The steps include: Assign a unique timestamp to each transaction; Each transaction starts by recording its own timestamp and comparing it with the timestamp of the data item in the database: If the self timestamp is earlier than or equal to the data item timestamp, the transaction performs a read operation to read the data item; If the self timestamp is later than the data item timestamp, the transaction performs a write operation.
2. The database optimization method according to claim 1, characterized in that: The method of assigning a unique timestamp to each transaction specifically includes: Use distributed clocks to obtain a unified timestamp for the system; A globally increasing sequence generator is used to ensure the uniqueness of the timestamp of each transaction.
3. The database optimization method according to claim 2, characterized in that: The globally increasing sequence generator is used to ensure the uniqueness of the timestamp of each transaction, specifically including: A global incrementing sequence generator is initialized to generate unique and increasing serial numbers; each time a data item is created, a new serial number is obtained through this sequence generator to ensure that each data item has a unique identifier.
4. The database optimization method according to claim 3, characterized in that: When each transaction is created, it obtains the current self-time stamp from the distributed clock and records the self-time stamp as the start time of the transaction; Each transaction also defines a read set to store the data items and their values read by the transaction; When each data item is created, it obtains a unique sequence number from the global incrementing sequence generator and records it as the timestamp of the data item.
5. The database optimization method according to claim 1, characterized in that: If the self timestamp is later than the data item timestamp, the transaction performs a write operation; wherein: If there are timestamp conflicts among multiple write operations, the conflict resolution strategy is executed: According to the priority rule, transactions with earlier timestamps have higher priority, and write operations are executed first to ensure the correctness and consistency of the write operations.
6. A database optimization method based on Paas cloud platform, used to achieve distributed management of multiple transactions; characterized in that: The steps include: The transaction participating nodes send operation requests to the coordinator, and the coordinator performs coordination operations in the preparation and submission phases; In the preparation phase, the transaction participating nodes perform operations and send preparation results to the coordinator, and the coordinator decides whether to commit the transaction based on the consistency check results; In the commit phase, the transaction participating nodes perform the final commit operation; If a failure occurs, the coordinator triggers failover and data recovery operations.
7. A database optimization method based on Paas cloud platform, used for processing and recovery of abnormal situations in data reading and writing; characterized by: Network delays and node failures are handled through fault-tolerant technology and data replication mechanisms, including: Replicate data to multiple nodes to ensure data consistency and availability; When a failure occurs, the system automatically performs failover and data recovery, migrating tasks and data to spare nodes or other available nodes.
8. A database read and write operation isolation device, characterized in that: include: The timestamp assignment module is used to assign a unique timestamp to each transaction; each transaction records its own timestamp at the beginning and compares it with the timestamp of the data item in the database; Comparison module, used to compare the transaction's own timestamp with the data item's timestamp: If the self timestamp is earlier than or equal to the data item timestamp, the transaction performs a read operation to read the data item; If the self timestamp is later than the data item timestamp, the transaction performs a write operation.
9. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the database optimization method based on the Paas cloud platform as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: At least one executable instruction is stored in the storage medium. When the executable instruction is executed on the electronic device, the electronic device executes the database optimization method based on the Paas cloud platform according to any one of claims 1 to 7.