Search

CN-122019632-A - Transaction data management method, apparatus, device, storage medium and program product

CN122019632ACN 122019632 ACN122019632 ACN 122019632ACN-122019632-A

Abstract

The embodiment of the application provides a transaction data management method, a device, equipment, a storage medium and a program product, and relates to the field of database management. The method comprises the steps of determining statement characteristic values of a first SQL statement, wherein the statement characteristic values comprise at least one of operation types, access object identifiers and grammar characteristics, determining target transaction characteristic identifiers corresponding to target transactions according to a plurality of statement characteristic values of a plurality of SQL statements when target transactions are submitted successfully, wherein the transactions corresponding to the SQL statements are target transactions, the first SQL statement is any SQL statement in the SQL statements, binding the target transaction characteristic identifiers and target transaction statistical data corresponding to the target transactions, and storing the target transaction statistical data in a storage space, wherein the target transaction statistical data comprise at least one of transaction identifiers, submitting time and client information. The method provided by the application improves the management capability of transaction data.

Inventors

  • LIU TIANHAO
  • WANG SHENGLI

Assignees

  • 中电科金仓(北京)科技股份有限公司

Dates

Publication Date
20260512
Application Date
20251229

Claims (10)

  1. 1. A transaction data management method, the method comprising: determining a statement feature value of a first SQL statement, wherein the statement feature value comprises at least one of an operation type, an access object identifier and a grammar feature; Under the condition that the target transaction is submitted successfully, determining a target transaction characteristic identifier corresponding to the target transaction according to a plurality of statement characteristic values of a plurality of SQL statements, wherein the transaction corresponding to the SQL statements is the target transaction, and the first SQL statement is any SQL statement in the SQL statements; Binding the target transaction characteristic identifier and target transaction statistics corresponding to the target transaction, and storing the target transaction statistics into a storage space, wherein the target transaction statistics comprise at least one of transaction identification, commit time and client information.
  2. 2. The method of claim 1, wherein the determining the target transaction characteristic identifier corresponding to the target transaction according to the plurality of statement characteristic values of the plurality of SQL statements comprises: Performing an aggregate hash process on the plurality of statement feature values to obtain the target transaction feature identifier, or, And carrying out bitmap structured coding on the statement characteristic values to obtain the target transaction characteristic identifier.
  3. 3. The method according to claim 1, wherein the method further comprises: Binding statement characteristic values of the first SQL statement and statistical data of the first SQL statement, and storing the statement characteristic values and the statistical data of the first SQL statement into the storage space.
  4. 4. A method according to claim 3, characterized in that the method further comprises: and acquiring the target transaction statistical data in the storage space.
  5. 5. The method of claim 1, wherein the plurality of statement feature values are stored in a cache space, the method further comprising: And discarding a plurality of statement characteristic values corresponding to the target transaction in the cache space under the condition that the target transaction fails to be submitted.
  6. 6. The method of claim 1, wherein determining the statement characteristic value of the first SQL statement comprises: Determining the statement characteristic value of the first SQL statement through the executor Hook of the database, or, Determining statement characteristic values of the first SQL statement by analyzing the log of the first SQL statement, or, And determining statement characteristic values of the first SQL statement through query plan analysis.
  7. 7. The method of claim 1, wherein determining the statement characteristic value of the first SQL statement comprises: Determining feature weight configuration according to the context information of the target transaction, wherein the feature weight configuration is used for indicating weights for extracting features of operation types, data object identifiers and/or grammar features; And determining statement feature values of the first SQL statement according to the feature weight configuration.
  8. 8. The method of claim 1, wherein determining the statement characteristic value of the first SQL statement comprises: Performing bottom object mapping processing and encoding processing on the first SQL statement, wherein the bottom object mapping processing is used for mapping a bottom object identifier of the first SQL statement into a target data object identifier, and the encoding processing is used for converting a grammar tree structure of the first SQL statement into target grammar feature encoding; And determining statement characteristic values of the first SQL statement according to the first SQL statement subjected to the mapping processing and the encoding processing of the bottom object.
  9. 9. A transaction data management device, the transaction data management device comprising: the first determining module is used for determining statement feature values of the first SQL statement, wherein the statement feature values comprise at least one of operation types, access object identifiers and grammar features; The second determining module is configured to determine, according to a plurality of statement feature values of a plurality of SQL statements, a target transaction feature identifier corresponding to the target transaction, where the transaction corresponding to the plurality of SQL statements is the target transaction, and the plurality of SQL statements includes the first SQL statement; And the storage module is used for binding the target transaction characteristic identifier and target transaction statistical data corresponding to the target transaction and storing the target transaction statistical data into a storage space, wherein the target transaction statistical data comprises at least one of transaction identification, commit time and client information.
  10. 10. An electronic device comprising a processor and a memory communicatively coupled to the processor; The memory stores computer-executable instructions; The processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 8.

Description

Transaction data management method, apparatus, device, storage medium and program product Technical Field The present application relates to the field of database management, and in particular, to a transaction data management method, apparatus, device, storage medium, and program product. Background In modern distributed database systems, transactions (transactions) are the core mechanism that guarantees data consistency and integrity. With the complexity of enterprise-level database application scenarios (such as financial transactions, electronic commerce order processing, and data acquisition of internet of things equipment), demands for fine monitoring, security audit and resource management of transaction execution processes are increasing. However, in existing implementations, the management capability for transaction data is poor. Disclosure of Invention The application provides a transaction data management method, a device, equipment, a storage medium and a program product, which are used for solving the technical problem of poor management capability of transaction data. In a first aspect, the present application provides a transaction data management method, comprising determining a statement characteristic value of a first structured query language (structured query language, SQL) statement, the statement characteristic value comprising at least one of an operation type, an access object identification, and a grammar characteristic; under the condition that the target transaction is submitted successfully, determining a target transaction characteristic identifier corresponding to the target transaction according to a plurality of statement characteristic values of a plurality of SQL statements, wherein the transaction corresponding to the SQL statements is the target transaction, and the first SQL statement is any SQL statement in the SQL statements; Binding the target transaction characteristic identifier and target transaction statistics corresponding to the target transaction, and storing the target transaction statistics into a storage space, wherein the target transaction statistics comprise at least one of transaction identification, commit time and client information. In a possible implementation manner of the first aspect, determining, according to a plurality of statement feature values of a plurality of SQL statements, a target transaction feature identifier corresponding to a target transaction includes: Performing aggregation hash processing on the statement characteristic values to obtain a target transaction characteristic identifier, or, And carrying out bitmap structured coding on the statement characteristic values to obtain the target transaction characteristic identifier. In a possible implementation manner of the first aspect, the method further includes: Binding statement feature values of the first SQL statement and statistical data of the first SQL statement, and storing the statement feature values and the statistical data of the first SQL statement into a storage space. In a possible implementation manner of the first aspect, the method further includes: target transaction statistics in the storage space are obtained. In a possible implementation manner of the first aspect, the plurality of statement feature values are stored in a cache space, and the method further includes: and discarding a plurality of statement characteristic values corresponding to the target transaction in the cache space under the condition that the target transaction fails to be submitted. In a possible implementation manner of the first aspect, determining a statement characteristic value of the first SQL statement includes: Determining statement characteristic values of the first SQL statement by an executor Hook of the database, or, Determining statement characteristic values of the first SQL statement by parsing a log of the first SQL statement or, Statement characteristic values of the first SQL statement are determined through query plan analysis. In a possible implementation manner of the first aspect, determining a statement characteristic value of the first SQL statement includes: Determining feature weight configuration according to the context information of the target transaction, wherein the feature weight configuration is used for indicating weights for feature extraction on operation types, data object identifiers and/or grammar features; and determining statement feature values of the first SQL statement according to the feature weight configuration. In a possible implementation manner of the first aspect, determining a statement characteristic value of the first SQL statement includes: Performing bottom object mapping processing and coding processing on the first SQL statement, wherein the bottom object mapping processing is to map a bottom object identifier of the first SQL statement into a target data object identifier, and the coding processing is to convert a grammar tree s