Session state data acquisition method and related equipment

By updating session status data in real-time in the database system, the shortcomings of ASH function in collecting SQL execution information are solved, the integrity of session status data is achieved, and the accuracy and efficiency of database performance monitoring and optimization are improved.

CN120045548APending Publication Date: 2025-05-27BEIJING OCEANBASE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510122856.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing active session history (ASH) function is insufficient when collecting the execution information of SQL statements, resulting in the inability to be fully recorded for key information such as SQL-ID, Plan-ID and Plan-Hash, which seriously weakens the accuracy and efficiency of database performance monitoring.

Method used

During the execution of SQL statements, once new execution information is generated, the previously collected session status data will be automatically updated to fill in the missing information and ensure the integrity of the session status data.

Benefits of technology

By ensuring the integrity of session status data, it provides complete and reliable support data for database performance monitoring and optimization, helping database administrators to efficiently troubleshoot and diagnose database performance problems, and improving the accuracy and efficiency of database performance monitoring and optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045548A_ABST
    Figure CN120045548A_ABST
Patent Text Reader

Abstract

The invention provides a session state data acquisition method and related equipment, which are applied to a database system, at least one session runs in the database system, and any target session in the at least one session comprises at least one SQL statement which is executed in sequence. The method comprises the steps of executing a target SQL statement contained in a target session, and periodically collecting session state data of the target session according to a preset collection frequency in the execution process of the target SQL statement; in response to execution information related to the target SQL statement generated in the process of executing the target SQL statement, obtaining session state data collected for the target session before the execution information is generated; according to the currently generated execution information, updating the collected session state data; wherein the execution information is newly added in the updated session state data.
Need to check novelty before this filing date? Find Prior Art

Claims

1. A method for collecting session state data, characterized in that: Applied to a database system, wherein at least one session is running in the database system, and any target session in the at least one session contains at least one SQL statement executed sequentially; the method comprises: Executing a target SQL statement contained in the target session, and during the execution of the target SQL statement, periodically collecting session state data of the target session according to a preset collection frequency; In response to execution information related to the target SQL statement being generated during the execution of the target SQL statement, acquiring session state data collected for the target session before the execution information is generated; The collected session state data is updated according to the currently generated execution information; wherein the execution information is newly added to the updated session state data.

2. The method according to claim 1, characterized in that The method further comprises: Writing the collected session state data into a preset buffer, and generating a data identifier corresponding to the session state data; wherein the data identifier is used to indicate a storage location of the session state data in the buffer; The updating of the collected session state data according to the currently generated execution information includes: A data identifier corresponding to the collected session state data is determined, and the currently generated execution information is written into a storage location in the buffer corresponding to the data identifier.

3. The method according to claim 2, characterized in that The method further comprises: Obtaining a query statement for the execution status of the target SQL statement; Parsing the query statement to obtain a query condition contained in the query statement; the query condition includes execution information related to the target SQL statement; A plurality of session state data matching the execution information is queried from the buffer, and the execution status of the target SQL statement is analyzed based on the plurality of session state data.

4. The method according to claim 3, characterized in that Before generating the execution information, a plurality of session state data are collected for the target session; and updating the collected session state data according to the currently generated execution information includes: According to the currently generated execution information, the collected multiple session state data are updated respectively.

5. The method according to claim 4, characterized in that The querying and obtaining from the buffer a plurality of session state data matching the execution information includes: A plurality of updated session state data including the execution information is obtained from the buffer.

6. The method according to claim 3, characterized in that Before generating the execution information, a plurality of session state data are collected for the target session; and updating the collected session state data according to the currently generated execution information includes: Determining the most recently collected session state data among the plurality of session state data; The most recently collected session state data is updated according to the currently generated execution information.

7. The method according to claim 6, characterized in that The querying and obtaining from the buffer a plurality of session state data matching the execution information includes: querying from the buffer to obtain an updated session state data including the execution information, and determining a session ID related to the target session and a tracking ID related to the current execution of the target SQL statement contained in the session state data; At least one unupdated session state data matching the session ID and the tracking ID is obtained from the buffer.

8. The method according to any one of claims 1 to 7, characterized in that: The execution process of the target SQL statement includes multiple stages; the currently generated execution information includes the SQL-ID of the target SQL statement generated in the parsing stage among the multiple stages, or the currently generated execution information includes the Plan-ID and / or Plan-Hash related to the execution plan of the target SQL statement generated in the optimization stage among the multiple stages.

9. A device for collecting session state data, characterized in that: Applied to a database system, wherein at least one session is running in the database system, and any target session in the at least one session contains at least one SQL statement executed sequentially; the device comprises: A collection unit, configured to execute a target SQL statement contained in the target session, and periodically collect session state data of the target session according to a preset collection frequency during the execution of the target SQL statement; an acquiring unit, configured to, in response to execution information related to the target SQL statement being generated during the execution of the target SQL statement, acquire session state data collected for the target session before the execution information is generated; An updating unit is used to update the collected session state data according to the currently generated execution information; wherein the execution information is newly added to the updated session state data.

10. A computing device, characterized in that: include: Memory and processor; The memory has stored thereon computer programs / instructions executable by the processor; When the processor runs the computer program / instructions, it performs the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: A computer program / instruction is stored thereon, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 8 is implemented.