Database tuning method, medium, product and equipment

By establishing preset process stack statistics tables and stack information tables in the database, and automatically analyzing and tuning the database process stack, the problem of automatic sampling and tuning in the existing technology is solved, and the database autonomous performance management is realized.

CN119441195APending Publication Date: 2025-02-14CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411596216.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art cannot automatically sample when analyzing database process stacks, especially when occasional performance problems are difficult to reproduce, and lacks a method for performance tuning without the help of external tools.

Method used

By establishing a preset process stack statistics table and stack information table in the database, after obtaining the tuning instructions, the problem stack is automatically determined, the stack information is obtained, the function call sequence is analyzed, and the optimization operation can be determined, thereby realizing database independent performance tuning.

Benefits of technology

It realizes that the database analyzes process stack information in different time periods without relying on external tools, identifies performance bottlenecks and optimizes it, improving the database's independent performance management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441195A_ABST
    Figure CN119441195A_ABST
Patent Text Reader

Abstract

The invention provides a database tuning method, a medium, a product and equipment. The method comprises the following steps: acquiring an adjusting and optimizing instruction of a database; in response to the tuning instruction, a problem stack is determined through a preset process stack statistical table, and the preset process stack statistical table is used for recording processes and stacks running in database instances of the database at different time; obtaining question stack information corresponding to the question stack in a preset stack information table, wherein the preset stack information table is used for recording stack information corresponding to the stack; determining a target stack sequence according to the problem stack information, wherein the stack sequence is used for recording an execution sequence of functions; and determining an optimizable operation according to the target stack sequence. By means of the method, the database can analyze the database process stack information in different time periods without the help of external tools, analyze possible performance bottlenecks on the basis of the database stack information and adjust and optimize the database process stack information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a database tuning method, medium, product and equipment. Background Art

[0002] Database systems often encounter various performance issues during operation. Generally, you can use the Linux system command pstack (a command line tool for viewing Linux process call stacks) to view the stack of the database process and analyze the typical function call relationship when performance problems occur in the database process, so as to perform targeted performance tuning. However, the pstack tool is not good at tracking function call stacks with very short execution time. Those functions are often not captured by pstack due to the execution time period. This problem is generally solved by generating a flame graph using perf (Linux built-in performance analysis tool).

[0003] However, in the above solutions, both pstack and perf need to be sampled manually, and cannot automatically sample the function call stack, especially when occasional performance problems have occurred and are difficult to reproduce. Therefore, a method is needed to enable the database system to have relevant performance tuning capabilities in an environment without performance tools such as pstack and perf. Summary of the invention

[0004] In view of the above problems, the present invention proposes a database tuning method, medium, product and device that overcome the above problems or at least partially solve the above problems.

[0005] An object of the present invention is to enable a database to analyze database process stack information within different time periods.

[0006] A further object of the present invention is to enable the database to analyze the stack information of the database process without the aid of external tools.

[0007] Yet another further object of the present invention is to enable the database to analyze possible performance bottlenecks based on database stack information and optimize the performance bottlenecks.

[0008] In particular, the present invention provides a database tuning method, comprising:

[0009] Get database tuning instructions;

[0010] In response to the tuning instruction, the problem stack is determined through a preset process stack statistics table, where the preset process stack statistics table is used to record the processes and stacks running in the database instances of the database at different times;

[0011] Obtaining problem stack information corresponding to the problem stack in a preset stack information table, the preset stack information table is used to record stack information corresponding to the stack, the stack information indicating the function call history during the process execution;

[0012] Determine the target stack sequence based on the problem stack information. The stack sequence is used to record the execution order of the function.

[0013] Determines optimizable operations based on the target stack sequence.

[0014] Optionally, the preset stack information table is used to record the stack identifier and stack information, and the stack information includes the stack level and the function name corresponding to the stack level;

[0015] The preset process stack statistics table is used to record the sampling timestamp, process ID, process name, and stack ID.

[0016] Optionally, the step of determining the problem stack through the preset process stack statistics table includes: searching the preset process stack statistics table for a stack whose occurrence times meet preset conditions as the problem stack, and obtaining a stack identifier corresponding to the problem stack;

[0017] The step of obtaining problem stack information corresponding to the problem stack in the preset stack information table includes: querying the problem stack information in the preset stack information table according to the stack identifier corresponding to the problem stack; and formatting the problem stack information to convert the problem stack information into a readable state.

[0018] Optionally, the step of determining an optimizable operation according to the target stack sequence includes:

[0019] Get the business SQL corresponding to the target stack sequence;

[0020] Analyze the business SQL and target stack sequence to obtain optimizable operations.

[0021] Optionally, the process of establishing the preset process stack statistics table and the preset stack information table includes:

[0022] At set intervals, collect the original stack information corresponding to each process in the database instance of the database;

[0023] The original stack information is simplified and the processing result is recorded in the preset process stack statistics table and the preset stack information table.

[0024] Optionally, the step of collecting the original stack information corresponding to each process in the database instance of the database includes: obtaining a process list of the database instance; querying one by one according to the process identifier in the process list to obtain the corresponding original stack information;

[0025] The steps of simplifying the original stack information include: removing information irrelevant to performance analysis in the original stack information, and retaining the stack levels and the function name corresponding to each stack level.

[0026] Optionally, the step of recording the processing result into the preset stack information table includes: determining whether the stack identifier already exists in the preset stack information table; if not, inserting a new entry into the preset stack information table according to the stack identifier, and recording the stack identifier and the stack information into the new entry;

[0027] The step of recording the stack identifier and the stack information into the new entry includes: assembling the stack information corresponding to the stack identifier into a character string in an array manner; and recording the stack identifier and the character string into the new entry.

[0028] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above database tuning methods are implemented.

[0029] According to yet another aspect of the present invention, a computer program product is provided, which includes a computer program. When the computer program is executed by a processor, the steps of any one of the above database tuning methods are implemented.

[0030] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements the steps of any of the above-mentioned database tuning methods when executing the machine executable program.

[0031] The database tuning method of the present invention first obtains the tuning instruction of the database; in response to the tuning instruction, determines the problem stack through a preset process stack statistics table; obtains the problem stack information corresponding to the problem stack in the preset stack information table; determines the target stack sequence according to the problem stack information, and the stack sequence is used to record the execution order of the function; and determines the optimizable operation according to the target stack sequence. Through this method, the database can analyze the database process stack information in different time periods without the help of external tools, and analyze the possible performance bottlenecks based on the database stack information and optimize them.

[0032] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:

[0034] Figure 1 is a flowchart of a database tuning method according to an embodiment of the present invention;

[0035] Figure 2 It is a schematic diagram of a data statistics flow of a preset stack information table and a preset process stack statistics table according to a database tuning method according to an embodiment of the present invention;

[0036] Figure 3 is a flowchart of a database tuning method according to another embodiment of the present invention;

[0037] Figure 4 is a schematic diagram of a computer program product according to an embodiment of the present invention;

[0038] Figure 5 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and

[0039] Figure 6 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and these embodiments are intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present invention.

[0041] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.

[0042] The present invention provides a database tuning method. Figure 1 FIG. 1 is a flow chart of a database tuning method according to an embodiment of the present invention. Figure 1As shown, the database tuning method at least includes the following steps S101 to S105.

[0043] Step S101, obtaining a database tuning instruction. Database systems often encounter various performance problems during operation, so tuning instructions can generally be automatically generated after the database detects a performance problem or actively input by the user during the use of the database. Those skilled in the art can decide how to obtain the tuning instruction according to actual conditions.

[0044] Step S102, in response to the tuning instruction, determine the problem stack through the preset process stack statistics table. The preset process stack statistics table is used to record the processes and stacks running in the database instances of the database at different times. In some optional embodiments, the preset process stack statistics table is generally used to record the sampling timestamp, process ID, process name and stack ID. An optional example of a stack ID is a unique ID such as a stack hash value, and the process ID is generally a PID. Those skilled in the art can determine the types of stack IDs and process IDs according to actual conditions.

[0045] An optional example of a preset process stack statistics table is shown in Table 1:

[0046] Table 1 Process stack statistics

[0047] Field Name type illustrate ts timestamp Sampling timestamp pid int Process PID process_name text Process Name stack_hash text Stack Hash Values

[0048] In some optional embodiments, the step of determining the problem stack through the preset process stack statistics table may generally include: querying the preset process stack statistics table for a stack whose occurrence times meet the preset conditions as the problem stack, and obtaining the stack identifier corresponding to the problem stack. For example, when the database adds, deletes, and modifies some tables, some performance problems are found. At this time, the database needs to be tuned, and the stack with the most occurrence times is queried in the preset process stack statistics table as the problem stack. It should be noted that the preset condition does not necessarily have to be the most times, but can also be a condition such as the number of occurrences being greater than the preset number. Those skilled in the art can determine the preset condition based on the actual performance problem.

[0049] Step S103, obtain the problem stack information corresponding to the problem stack in the preset stack information table. Among them, the preset stack information table is generally used to record the stack identifier and stack information, and the stack information generally can include the stack level and the function name corresponding to the stack level. The level of the stack usually refers to the depth of the function call. When a function calls another function, a new stack frame will be created on top of the current stack frame, forming a stack level, and the stack level is usually represented by a number (such as #0, #1, etc.), and the smaller the number, the closer to the bottom layer. An optional example of the preset stack information table is shown in Table 2:

[0050] Table 2 Stack information table

[0051] Field Name type illustrate hash text Stack Hash Values stack text Stack Information

[0052] Optionally, the step of obtaining problem stack information corresponding to the problem stack in the preset stack information table may generally include: querying the problem stack information in the preset stack information table according to the stack identifier corresponding to the problem stack; formatting the problem stack information to convert the problem stack information into a readable state.

[0053] Step S104, determining the target stack sequence according to the problem stack information. The stack sequence usually refers to the function call history formed by function calls during program execution, and each layer represents a function call. Understanding the stack sequence can help diagnose problems in the program, especially performance bottlenecks, deadlocks or hangs.

[0054] Step S105, determining the optimizable operations according to the target stack sequence. Since performance optimization needs to analyze and determine the optimizable operations in combination with actual business, the step of determining the optimizable operations according to the target stack sequence may generally include: obtaining the business SQL corresponding to the target stack sequence; and obtaining the optimizable operations according to the business SQL and the target stack sequence analysis.

[0055] Through this method, the database can analyze database process stack information in different time periods without the help of external tools, and analyze possible performance bottlenecks based on the database stack information and optimize them.

[0056] In some optional embodiments, the process of establishing a preset process stack statistics table and a preset stack information table may generally include: collecting the original stack information corresponding to each process in the database instance of the database at set intervals; simplifying the original stack information, and recording the processing results in the preset process stack statistics table and the preset stack information table.

[0057] Optionally, the step of collecting original stack information corresponding to each process in a database instance of the database may generally include: obtaining a process list of the database instance; and querying one by one according to process identifiers in the process list to obtain corresponding original stack information.

[0058] An optional operation of the establishment process of the above-mentioned process stack statistics table and the preset stack information table in the current existing database technology is: obtain the process list of the database instance through the interface provided by the database or the Linux ps command, for example, query the entire process list of the current database instance through the function sys_stat_get_inst_pids(), and each process in the process list corresponds to a process number (pid). For each process number (pid) in the list, execute the Linux pstack{pid} command to obtain the original execution stack information of the process.

[0059] An example of raw stack information is as follows:

[0060] #16 0x00000000004b2d3c in main(argc=3,argv=0x19a62ec0)at main.c:299

[0061] The meanings of different positions are as follows:

[0062] Stack level: #16, indicating that it is on the 16th stack level

[0063] Function pointer: 0x00000000004b2d3c, function pointer in the process address space

[0064] Function name: in main

[0065] Function parameters: (argc=3, argv=0x19a62ec0)

[0066] Source code information: at main.c:299

[0067] Since the above part of information is irrelevant to performance analysis, in order to reduce the consumption of storage space, the original stack information needs to be simplified so as to retain the stack level and the function name corresponding to each stack level. Optionally, the step of simplifying the original stack information may generally include: removing the information irrelevant to performance analysis in the original stack information, retaining the stack level and the function name corresponding to each stack level. The final simplified result may be #16main.

[0068] After the simplified processing, the processing result needs to be recorded in the preset stack information table. Optionally, the step of recording the processing result in the preset stack information table may generally include: determining whether the stack identifier already exists in the preset stack information table; if not, inserting a new entry in the preset stack information table according to the stack identifier, and recording the stack identifier and stack information in the new entry. If yes, it means that the stack information of the process has been recorded in the preset stack information table, so it can be determined whether the stack information is the same. If yes, it is selected to return, thereby reducing database resource consumption and improving recording efficiency.

[0069] In some optional embodiments, the step of recording the stack identifier and the stack information into the new entry includes: assembling the stack information corresponding to the stack identifier into a string in an array manner; and recording the stack identifier and the string into the new entry.

[0070] Figure 2 FIG. 1 is a schematic diagram of a data statistics flow of a preset stack information table and a preset process stack statistics table according to a database tuning method according to an embodiment of the present invention. Figure 2 As shown, the method at least includes the following steps S201 to S206.

[0071] Step S201, at set intervals, obtain a process list of a database instance.

[0072] Step S202, querying and obtaining corresponding original stack information according to the process identifiers in the process list one by one.

[0073] Step S203, simplifying the original stack information.

[0074] Step S204: determine whether a stack identifier already exists in the preset stack information table.

[0075] Step S205: if the judgment in step S204 is no, insert a new entry into the preset stack information table according to the stack identifier, and record the stack identifier and the stack information into the new entry.

[0076] Step S206, updating the preset process stack statistics table.

[0077] In order to clearly illustrate the storage process of the present invention, an implementation process based on currently available database technology is provided:

[0078] First, step S201 is executed to obtain the process list of the database instance through the interface provided by the database or the Linux ps command at set intervals. For example, the entire process list of the current database instance is queried through the function sys_stat_get_inst_pids(). Specifically, the SQL statement shown in Formula 1 is used to query the current database instance:

[0079] select*from sys_stat_get_inst_pids() Formula 1

[0080] The query result example is shown in Table 3:

[0081] Table 3

[0082] pid name 60651 postmaster 60656 background writer …… …… 65016 client backend

[0083] The first column represents the process ID (also known as pid) of each process, and the second column represents the process name of each process.

[0084] After obtaining the query result, execute step S202 (taking 65016 as an example), and execute the Linux pstack{pid} command for each process number (pid) in the list to obtain the original execution stack information of the process.

[0085] An example of raw stack information is as follows:

[0086] #16 0x00000000004b2d3c in main(argc=3,argv=0x19a62ec0)at main.c:299

[0087] The meanings of different positions are as follows:

[0088] Stack level: #16, indicating that it is on the 16th stack level

[0089] Function pointer: 0x00000000004b2d3c, function pointer in the process address space

[0090] Function name: in main

[0091] Function parameters: (argc=3, argv=0x19a62ec0)

[0092] Source code information: at main.c:299

[0093] Since the above part of information is irrelevant to performance analysis, in order to reduce the consumption of storage space, it is necessary to perform step S203 to simplify the original stack information, thereby retaining the stack level and the function name corresponding to each stack level. The final processing result is as follows:

[0094]

[0095] After step S203 is completed, the process number, process name, and process stack of each process of the database instance are obtained, and they need to be stored in the statistical table. In order to reduce the consumption of storage space, the stack information (stack level and function name) and the process stack information (sampling time, process ID, process name, and stack ID) can be stored separately.

[0096] When storing stack information, since there are multiple stack levels, in order to facilitate storage and recording, the stack information corresponding to the stack identifier can be assembled into a string in an array, and then the stack identifier and the string are recorded in a new entry according to the corresponding relationship. Those skilled in the art can determine the assembly method according to the string that the database can adapt. An optional example of the string is as follows:

[0097] {0,ExecInsertData},{1,ExecModifyTable},{2,ExecutorProcNode},……{15,KesMasterMain},{16,main}

[0098] Then, step S204 is executed to determine whether the stack identifier already exists in the preset stack information table. If not, step S205 is executed to insert a new entry into the preset stack information table according to the stack identifier and record the stack identifier and stack information in the new entry.

[0099] Then, step S206 is executed to update the preset process stack statistics table, and the sampling time (current time), process identifier, process name, and stack identifier are stored in the process stack statistics table, where the process identifier may be the process pid, and the stack identifier may be the stack hash value.

[0100] In addition, in order to prevent the process stack statistics table from expanding due to continuous automatic sampling of the stack information of the database instance process, a fixed time period (e.g., every day) can be set to automatically clean up the statistics that exceed a preset number of days, such as 8 days, and clean up the hash values ​​that are no longer used in the stack information table. Those skilled in the art can determine the trigger time and degree of automatic cleaning based on the actual data growth of the database and the capacity of the database.

[0101] Figure 3 FIG. 1 is a flow chart of a database tuning method according to another embodiment of the present invention. Figure 3 As shown, the database tuning method at least includes the following steps S301 to S306.

[0102] Step S301, obtaining a database tuning instruction.

[0103] Step S302: Searching a preset process stack statistics table for a stack whose occurrence times meet preset conditions as a problem stack, and obtaining a stack identifier corresponding to the problem stack.

[0104] Step S303: query the preset stack information table according to the stack identifier corresponding to the problem stack to obtain the problem stack information.

[0105] Step S304: formatting the problem stack information.

[0106] Step S305, determining the target stack sequence according to the problem stack information.

[0107] Step S306, obtaining the business SQL corresponding to the target stack sequence.

[0108] Step S307, analyzing the business SQL and the target stack sequence to obtain optimizable operations.

[0109] Through this method, the database can analyze database process stack information in different time periods without the help of external tools, and analyze possible performance bottlenecks based on the database stack information and optimize them.

[0110] The specific application of the method of the present invention in the current database is as follows:

[0111] In some optional embodiments, when the database adds, deletes, or modifies some tables, some performance problems are found. At this time, after the database system automatically generates a tuning instruction or manually inputs a tuning instruction, step S302 is executed, and the database searches the stack that meets the preset conditions through the stack information statistics table. Generally, the stack with the most occurrences has the greatest impact on the database performance. Therefore, the preset condition in this embodiment can be the stack with the most occurrences. The specific query statement is shown in Formula 2:

[0112] select count(ts)as calls,stack_hash from sys_stat_stack_info group bystack_hash order by 1desc; Formula 2

[0113] sys_stat_stack_info is the name of the stack information statistics table

[0114] Since the process stack statistics table records the sampling timestamp, process ID, process name and stack ID, and the stack ID is generally a hash value, the result example of the SQL statement shown in Formula 2 executed in the database is shown in Table 4:

[0115] Table 4

[0116]

[0117]

[0118] As can be seen from Table 4, the stack with the most frequent occurrence is the stack with a hash value of 13570e3b62. It has been captured the most times, reaching more than 765,000 times. This stack has the greatest impact on the performance of this database instance, so it is regarded as a problem stack.

[0119] Then, step S303 is executed to obtain the problem stack information according to the stack identifier (i.e., 13570e3b62) corresponding to the problem stack in the preset stack information table. At this time, the problem stack information obtained is a string. For ease of reading, step S304 is selected to format the problem stack information, so as to convert it into a format suitable for reading, such as multiple lines. The converted target stack sequence result example is as follows:

[0120] 0WalInsert

[0121] 1HeapInsert

[0122] 2HeapTAMRowInsert

[0123] 3ExecInsertData

[0124] 4ExecModifyTable

[0125] 5ExecutorProcNode

[0126] 6ExecutorPlan

[0127] …

[0128] 18KesMasterMain

[0129] 19main

[0130] 0 indicates the stack level, and WalInsert indicates the function name of the level. Since the smaller the level number is, the closer it is to the bottom layer, the target stack sequence can be determined. The most critical stack sequence is: ExecModifyTable->ExecInsertData->HeapTAMRowInsert->HeapInsert->WalInsert. From this, we can analyze that the cause of this performance problem may be that the Insert record of the relational table is slow when writing the WAL log.

[0131] Then, combined with the business SQL analysis, the problematic SQL statement needs to write a large amount of non-critical information to a table, which is frequently written and updated, and then immediately truncated to completely clear the records. Therefore, it can be determined that the operation that can be optimized is to reduce the amount of data written to the log.

[0132] After adjusting based on actual business, the table can be modified to an unlogged table, that is, the WAL log is not recorded for the addition, deletion, and modification operations of the table. After the modification is completed, the database business load is re-run, and WalInsert disappears from the stack with the most execution times, and the database performance is significantly improved.

[0133] In addition, in some other optional embodiments, there are multiple ways to query the stack information of the database instance process, which can replace the manual multiple refreshes of the pstack information, and can query the stack information of the past time, bringing convenience to performance tuning. The specific operation examples are as follows:

[0134] 1. The operation example corresponding to querying the statistics of all process stacks is shown in Formula 3:

[0135] select i.*,h.stack from sys_stat_stack_info i,sys_stat_stack_hash hwhere i.stack_hash = h.hash Formula 3

[0136] Among them, sys_stat_stack_info is the name of the process stack statistics table, and sys_stat_stack_hash is the name of the stack information table.

[0137] 2. The operation example corresponding to querying the stack information within a specified time period in the past is shown in Formula 4:

[0138] select i.*,h.stack from sys_stat_stack_info i,sys_stat_stack_hash hwhere i.stack_hash=h.hash where ts between'2024-07-22 10:31:28'and'2024-07-2300:12:31'Equation 4

[0139] 3. The operation example corresponding to querying all the stack information of a process is shown in Formula 5:

[0140] select i.*,h.stack from sys_stat_stack_info i,sys_stat_stack_hash hwhere i.stack_hash = h.hash where pid = 65016 Equation 5

[0141] 4. The operation example corresponding to querying the stack information of a certain type of process is shown in Formula 6:

[0142] select i.*,h.stack from sys_stat_stack_info i,sys_stat_stack_hash hwhere i.stack_hash = h.hash where process_name='client backend' Equation 6

[0143] 5. The operation example corresponding to querying the stack information with the most occurrences is shown in Formula 7:

[0144] select count(ts)as calls,stack_hash,stack from sys_stat_stack_info i,sys_stat_stack_hash h where i.stack_hash = h.hash group by stack_hash, stack formula 7

[0145] Those skilled in the art can select a corresponding query method according to actual conditions to determine the problem stack and problem stack information.

[0146] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.

[0147] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0148] This embodiment also provides a computer program product 10 , a computer readable storage medium 20 , and a computer device 30 . Figure 4 is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Figure 5is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention, Figure 6 is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned database tuning methods when executed by a processor 32. The computer-readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of any of the above-mentioned database tuning methods when executed by the processor 32. The computer device 30 may include a memory 31, a processor 32, and the computer program 11 stored in the memory 31 and running on the processor 32.

[0149] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages ​​and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.

[0150] For the purposes of the description of the present embodiment, the computer program product 10 is a related product that includes the computer program 11. For the purposes of the description of the present embodiment, the computer readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate or transmit the program 11 for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of the computer readable storage medium 20 include the following: 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), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the foregoing.

[0151] The computer device 30 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.

[0152] The computer device 30 may include a processor 32 adapted to execute stored instructions, and a memory 31 providing temporary storage space for the operation of the instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.

[0153] The computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that may be connected to the computer device. The network adapter / interface may provide communication between the computer device and a network, which is typically shown as a communication network.

[0154] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.

Claims

1. A database tuning method, comprising: Obtaining tuning instructions for the database; In response to the tuning instruction, determining the problem stack through a preset process stack statistics table, wherein the preset process stack statistics table is used to record processes and stacks running in the database instance of the database at different times; Acquire problem stack information corresponding to the problem stack in a preset stack information table, wherein the preset stack information table is used to record stack information corresponding to the stack, and the stack information represents a function call history during the execution of the process; Determining a target stack sequence according to the problem stack information, wherein the stack sequence is used to record the execution order of the function; An optimizable operation is determined based on the target stack sequence.

2. The database tuning method according to claim 1, wherein: The preset stack information table is used to record the stack identifier and stack information, and the stack information includes the stack level and the function name corresponding to the stack level; The preset process stack statistics table is used to record sampling timestamp, process identifier, process name and stack identifier.

3. The database tuning method according to claim 2, wherein: The step of determining the problem stack through the preset process stack statistics table includes: searching the preset process stack statistics table for a stack whose occurrence times meet the preset conditions as the problem stack, and obtaining the stack identifier corresponding to the problem stack; The step of obtaining the problem stack information corresponding to the problem stack in the preset stack information table includes: obtaining the problem stack information by querying the preset stack information table according to the stack identifier corresponding to the problem stack; and formatting the problem stack information to convert the problem stack information into a readable state.

4. The database tuning method according to claim 2, wherein: The step of determining the optimizable operation according to the target stack sequence comprises: Obtain the business SQL corresponding to the target stack sequence; The optimizable operation is obtained according to the business SQL and the target stack sequence analysis.

5. The database tuning method according to claim 2, wherein: The establishment process of the preset process stack statistics table and the preset stack information table includes: At set intervals, collecting original stack information corresponding to each process in the database instance of the database; The original stack information is simplified and the processing result is recorded in the preset process stack statistics table and the preset stack information table.

6. The database tuning method according to claim 5, wherein: The step of collecting the original stack information corresponding to each process in the database instance of the database includes: obtaining a process list of the database instance; querying one by one according to the process identifier in the process list to obtain the corresponding original stack information; The step of simplifying the original stack information includes: removing information irrelevant to performance analysis in the original stack information, and retaining the stack levels and the function names corresponding to each stack level.

7. The database tuning method according to claim 5, wherein: The step of recording the processing result into the preset stack information table comprises: determining whether the stack identifier already exists in the preset stack information table; if not, inserting a new entry into the preset stack information table according to the stack identifier, and recording the stack identifier and the stack information into the new entry; The step of recording the stack identifier and the stack information into the new entry includes: assembling the stack information corresponding to the stack identifier into a character string in an array manner; and recording the stack identifier and the character string into the new entry.

8. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the database tuning method according to any one of claims 1 to 7 are implemented.

9. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the database tuning method according to any one of claims 1 to 7 are implemented.

10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the steps of the database tuning method according to any one of claims 1 to 7 when executing the machine executable program.