Database performance test method and device, computer program product and electronic equipment
By analyzing and automatically supplementing unknown parameters in the database structured query statement, and performing tests in the database before and after transformation, the problem of performance testing after database transformation is solved, and fully automated SQL performance testing is realized, which improves testing efficiency and coverage.
Patent Information
- Application Number
- CN202411917878.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-08
AI Technical Summary
The existing technology has difficulties in performance testing after database transformation. The test method relies on the execution of service interfaces or requires manual filling and execution of structured query statements. The process is cumbersome and poor transplantability, resulting in incomplete testing coverage and a large amount of manpower and material support.
Provide a database performance testing method, which automatically supplements unknown parameters by parsing the initial structured query statement, generates target structured query statements, and executes in the database before and after transformation, and calculates execution parameters to determine the execution performance of the database.
It realizes full automation of SQL performance testing after database transformation, simplifies the testing process, eliminates the tedious operation of filling in individual parameters, and improves the coverage and efficiency of tests.
Smart Images

Figure CN119782118A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data, and more specifically, to a database performance testing method, device, computer program product, and electronic device. Background Art
[0002] Hot topics in the financial technology industry in recent years include the transformation of computer equipment, operating systems, various basic software applications, and especially the transformation of database software.
[0003] During this transformation process, the performance testing methods of related technologies either rely on service interface execution, which cannot directly reflect database performance, or require manual parameter filling to execute structured query statements (SQL, Structured Query Language) testing, which is cumbersome and has poor portability. Therefore, related technologies have obvious limitations and insufficient applicability in database transformation performance evaluation, resulting in incomplete coverage of the test process and requiring a lot of manpower and material support.
[0004] With regard to the difficulty of performance testing after database transformation in related technologies, no effective solution has been proposed so far. Summary of the invention
[0005] The main purpose of the present application is to provide a database performance testing method, device, computer program product and electronic device to solve the problem of difficulty in performance testing of database after transformation in the related art.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a database performance testing method is provided. The method includes: parsing an initial structured query statement in a first database, and supplementing the unknown parameters of the conditional statement in the parsing result to obtain a target structured query statement, wherein the first database is a database transformed from the second database; executing the target structured query statement in the first database, and calculating the execution parameters to obtain the first execution parameters; executing the target structured query statement in the second database, and calculating the execution parameters to obtain the second execution parameters; determining the execution performance of the first database according to the first execution parameters and the second execution parameters.
[0007] Optionally, parsing an initial structured query statement in the first database and supplementing unknown parameters of conditional statements in the parsing result to obtain a target structured query statement includes: using a parser to parse the structured query statement to obtain a result tree, wherein the result tree includes multiple levels of data, and the data in each level includes at least one of the following: conditional statements, table query statements, column query statements, and restriction statements; generating a constant expression list and a table structure information list based on the data in the result tree; identifying unknown parameters from all conditional statements in the result tree; querying the values of unknown parameters based on the constant expression list and the table structure information list; and filling the values of the unknown parameters into the initial structured query statement to obtain the target structured query statement.
[0008] Optionally, generating a constant expression list and a table structure information list based on the data in the result tree includes: obtaining all conditional statements and all table query statements from the result tree; identifying known constant expressions from all conditional statements, and storing the identified known constant expressions in a constant expression list; identifying known constant expressions and table structure information from all table query statements, storing the identified known constant expressions in a constant expression list, and storing the identified table structure information in a table structure information list.
[0009] Optionally, identifying known constant expressions from all conditional statements and storing the identified known constant expressions in a constant expression list includes: for each conditional statement, recursively judging the type of the expression, and when an expression containing an and condition is identified, continuing to recursively judge the expressions on both sides of the and condition; when an expression containing an or condition is identified, if both sides of the or condition are constant expressions, adding the or condition to the constant expression list; when a basic expression is identified, if both sides of the basic expression are constant expressions, adding the basic expression to the constant expression list.
[0010] Optionally, querying the value of an unknown parameter based on a constant expression list and a table structure information list includes: concatenating a structured query statement through the table structure information list and the constant expression list; taking the value of the unknown parameter as content to be queried, executing the concatenated structured query statement in the first database, and obtaining a query result for the content to be queried; when the query result is not empty, determining the query result as the value of the unknown parameter; when the query result is empty, determining an empty string as the value of the unknown parameter.
[0011] Optionally, executing the target structured query statement in the first database and calculating the execution parameters to obtain the first execution parameters includes: concurrently executing multiple target structured query statements according to N threads in the first database, calculating the query rate per second of each thread, and determining the maximum query rate per second among the N threads as the first execution parameter; executing the target structured query statement in the second database and calculating the execution parameters to obtain the second execution parameters includes: concurrently executing multiple target structured query statements according to N threads in the second database, calculating the query rate per second of each thread, and determining the maximum query rate per second among the N threads as the second execution parameter.
[0012] Optionally, in the first database, multiple target structured query statements are concurrently executed according to N threads, and the query rate per second of each thread is calculated, including: importing all generated target structured query statements into a task table; using batch tasks to scan the task table at preset time intervals, and when a new target structured query statement is scanned, executing the new target structured query statement concurrently according to N threads in the first database; updating the maximum query rate per second of the N threads according to the execution time of the new target structured query statement, and storing the updated maximum query rate per second in the task table.
[0013] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a database performance testing device is provided. The device includes: a statement parsing module, which is used to parse the initial structured query statement in the first database, and supplement the unknown parameters of the conditional statement in the parsing result to obtain the target structured query statement, wherein the first database is a database transformed from the second database; a first execution parameter calculation module, which is used to execute the target structured query statement in the first database, and calculate the execution parameter to obtain the first execution parameter; a second execution parameter calculation module, which is used to execute the target structured query statement in the second database, and calculate the execution parameter to obtain the second execution parameter; a performance determination module, which is used to determine the execution performance of the first database according to the first execution parameter and the second execution parameter.
[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a computer program product is provided, which includes: a non-volatile computer-readable storage medium storing a computer program, and the computer program implements a database performance testing method when executed by a processor.
[0015] In order to achieve the above object, according to another aspect of the present application, an electronic device is provided. The device includes: a memory storing a computer program, and a processor configured to execute a database performance testing method through the computer program.
[0016] In an embodiment of the present application, an initial structured query statement in a first database is parsed, and the unknown parameters of the conditional statement in the parsing result are supplemented to obtain a target structured query statement, wherein the first database is a database transformed from the second database; the target structured query statement is executed in the first database, and the execution parameter is calculated to obtain a first execution parameter; the target structured query statement is executed in the second database, and the execution parameter is calculated to obtain a second execution parameter; the execution performance of the first database is determined according to the first execution parameter and the second execution parameter. By parsing the initial structured query statement and automatically filling in the unknown parameters, the first execution parameter is the parameter in the statement to be executed by the database after the transformation, and the second execution parameter is the parameter in the statement to be executed by the database before the transformation, the purpose of simplifying the test process and eliminating the tedious operation of filling in individual parameters is achieved, thereby achieving the technical effect of fully automated SQL performance testing after database transformation, and thus solving the problem of difficulty in database performance testing after transformation in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing a database performance testing method;
[0019] Figure 2 is a flowchart of a database performance testing method provided according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of a result tree provided according to an embodiment of the present application;
[0021] Figure 4 It is a schematic diagram of the automatic parameter filling process of the structured query statement provided in the embodiment of the present application;
[0022] Figure 5 It is a flowchart of automatic execution of structured query statements provided in an embodiment of the present application;
[0023] Figure 6 It is a statistical graph of query rate per second provided according to an embodiment of the present application;
[0024] Figure 7 is a schematic diagram of an automatic parameter filling algorithm provided according to an embodiment of the present application;
[0025] Figure 8 is a schematic diagram of a database performance testing device provided according to an embodiment of the present application;
[0026] Fig. 9 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] It should be noted that the collected information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with relevant laws, regulations and standards, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or institutions to provide users with corresponding operation entrances for users to choose to agree or refuse the results of automated decision-making; if the user chooses to refuse, the expert decision-making process will be entered.
[0030] Example 1
[0031] According to an embodiment of the present application, a method embodiment of code performance testing is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0032] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 It is a hardware structure diagram of a computer terminal used to implement a database performance testing method. Figure 1 As shown, the computer terminal 10 may include one or more ( Figure 1 The system includes a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor (MCU, Microcontroller Unit) or a programmable logic device (FPGA, Field-Programmable Gate Array)), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface, Input / Output interface), a universal serial bus (USB, Universal Serial Bus) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0033] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0034] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the database performance test method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the above-mentioned database performance test method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0035] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0036] The display may be, for example, a touch screen liquid crystal display (LCD), which may enable a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0037] Under the above operating environment, this application provides Figure 2 The database performance testing method shown. Figure 2 It is a flowchart of a database performance testing method provided according to an embodiment of the present application.
[0038] Step S201, parsing an initial structured query statement in a first database, and supplementing unknown parameters of a conditional statement in the parsing result to obtain a target structured query statement, wherein the first database is a database transformed from the second database;
[0039] Specifically, the initial structured query statement is a structured query statement containing unknown parameters. Since database operation types such as INSERT, UPDATE, and DELETE do not support multi-concurrent execution, the structured query statement described in the embodiment of the present application may be a SELECT operation type. The first database is a transformed database, which may be migrated or transformed from the second database. The initial structured query statement is the original SQL query statement, which may contain unknown parameters and constant expressions; the parsing process converts the SQL query statement into a data structure, which may be a tree structure, so that each part can be independently identified and processed.
[0040] The unknown parameters of a conditional statement refer to the unknown parameters that need to be automatically filled in. The conditional statement is a statement in a structured query statement that can perform expression judgment.
[0041] The target structured query statement is a complete and executable SQL query statement in which all parameters have been added and can be directly run in the database.
[0042] Step S202, executing the target structured query statement in the first database, and calculating the execution parameter to obtain the first execution parameter;
[0043] Specifically, the execution parameters refer to some indicators used to measure query performance. The execution parameters may include: response time, query rate per second. The first execution parameter refers to the performance indicator calculated after running the target SQL query statement in the first database.
[0044] Step S203, executing the target structured query statement in the second database, and calculating the execution parameter to obtain a second execution parameter;
[0045] Specifically, the second execution parameter refers to a performance indicator calculated after the target SQL query statement is executed in the second database.
[0046] Step S204: determining the execution performance of the first database according to the first execution parameter and the second execution parameter.
[0047] Specifically, the first execution parameter and the second execution parameter are calculated for comparison to obtain the performance difference of the database transformation. The comparison method may be to compare the response time and query rate per second of the two. The faster the response time and the higher the query rate per second after the database transformation, the more suitable the current statement is for running in the database.
[0048] In an embodiment of the present application, an initial structured query statement in a first database is parsed, and the unknown parameters of the conditional statement in the parsing result are supplemented to obtain a target structured query statement, wherein the first database is a database transformed from the second database; the target structured query statement is executed in the first database, and the execution parameter is calculated to obtain a first execution parameter; the target structured query statement is executed in the second database, and the execution parameter is calculated to obtain a second execution parameter; the execution performance of the first database is determined according to the first execution parameter and the second execution parameter. By parsing the initial structured query statement and automatically filling in the unknown parameters, the first execution parameter is the parameter in the statement to be executed by the database after the transformation, and the second execution parameter is the parameter in the statement to be executed by the database before the transformation, the purpose of simplifying the test process and eliminating the tedious operation of filling in individual parameters is achieved, thereby achieving the technical effect of fully automated SQL performance testing after database transformation, and thus solving the problem of difficulty in database performance testing after transformation in related technologies.
[0049] In order to obtain a target structured query statement, optionally, in the database performance testing method provided in an embodiment of the present application, an initial structured query statement in a first database is parsed, and unknown parameters of conditional statements in the parsing result are supplemented to obtain the target structured query statement, including: using a parser to parse the structured query statement to obtain a result tree, wherein the result tree includes data at multiple levels, and the data in each level includes at least one of the following: conditional statements, table query statements, column query statements, and restriction statements; generating a constant expression list and a table structure information list based on the data in the result tree; identifying unknown parameters from all conditional statements in the result tree; querying the values of unknown parameters based on the constant expression list and the table structure information list; and filling the values of the unknown parameters into the initial structured query statement to obtain the target structured query statement.
[0050] Specifically, the parser is a tool for analyzing SQL statements. Its function is to break down the input SQL query into different parts, generate structured statements, and generate a result tree; the result tree is a structured representation of the SQL statement after the parser parses it, which is convenient for parsing and manipulating the internal structure of the SQL statement, and describes the hierarchical relationship between the various parts of the SQL statement. The constant expression list and the table structure information list respectively record the known conditions and the table structure information involved in the query. They are the core data obtained after parsing the SQL statement, and are used to guide subsequent parameter filling and performance testing. Unknown parameters are values used to supplement in database queries. In the performance test of the embodiment of the present application, they are filled in by automatically filling in parameters.
[0051] Figure 3 is a schematic diagram of a result tree provided according to an embodiment of the present application, such as Figure 3As shown, the result tree of the structured query statement is divided into multiple levels, where the conditional statement can be SELECT, the table query statement can be FROM, the column query statement can be WHERE, and the restriction statement can include the LIMIT statement; if a statement includes a subquery statement, the subquery statement will be executed until all subquery statements are executed. Figure 4 is a schematic diagram of the automatic parameter filling process of the structured query statement provided in the embodiment of the present application, such as Figure 4 As shown, the initial structured query statement is:
[0052] For example, a conventional precompiled SQL statement such as "SELECT COUNT(*) AS C FROM TABLE T WHERET.C1 = ? AND T.C2 = 'V2' AND T.C3 = ?;" is parsed by the parser JSQLParser to obtain the following data structure:
[0053] SELECT = {COUNT(*) AS C};
[0054] FROM = {T}
[0055] WHERE={T.C1=? ,T.C2='V2',T.C3=?}
[0056] Among them, '?' represents a placeholder. In the WHERE condition, the value of C2 in the table TABLE is known, while the values of C1 and C3 are unknown. After the SQL statement is parsed, the values of C1 and C3 are completed through the automatic parameter filling algorithm.
[0057] The embodiment of the present application generates a constant expression list and a table structure information list in the form of a parser and a result tree, identifies unknown parameters, and finally fills the values of the unknown parameters into the initial structured query statement to obtain the target structured query statement. Executing the above steps can be used to test the SQL statement execution performance of the database.
[0058] In order to obtain constant expressions and table structure information, optionally, in the database performance testing method provided in the embodiment of the present application, generating a constant expression list and a table structure information list based on the data in the result tree includes: obtaining all conditional statements and all table query statements from the result tree; identifying known constant expressions from all conditional statements, and storing the identified known constant expressions in a constant expression list; identifying known constant expressions and table structure information from all table query statements, storing the identified known constant expressions in a constant expression list, and storing the identified table structure information in a table structure information list.
[0059] Specifically, the table query statement describes the table structure information and constant expressions involved in the SQL query; the constant expression describes the fixed value in the SQL query, which is used for condition judgment and data selection; the table structure information provides a detailed description of the table, so that the system can correctly match the field type and content when processing the query.
[0060] The conditional statement can be a WHERE statement, and the known constant expressions are identified from all the conditional statements, and the identified known constant expressions are stored in the constant expression list, including: storing the constants in the constant expression in the constant expression list WhereList through a constant recursive algorithm. The constant recursive algorithm is to analyze the AND and OR conditions one by one to determine whether the WHERE expression is AND or OR. If it is an AND expression, it is skipped when the left side of the AND expression is an OR expression, otherwise the expressions on the left and right sides of the AND expression are reassigned for recursive judgment. If it is an OR expression, it is determined whether the left side of the OR expression is a constant expression. If so, it is determined whether the right side of the OR expression is a constant expression. If so, the OR expression is added to the WhereList and yes is returned, otherwise no is returned. Yes and no represent whether the connection between the constant expressions is and or or. Then determine which basic (=, >, >=, <, <=, !=, IN, etc.) expression the expression belongs to, and then determine whether it is a constant expression by the types of the left and right sides. If so, yes is returned, otherwise no is returned.
[0061] The table query statement may be a FROM statement, and the step of identifying the known constant expression and the table structure information may be to determine whether there is a JOIN connection in the FROM part, and if not, store the table structure information in the FROM into the table structure information list TableList. If there is a JOIN connection, further determine whether the JOIN connection has a subquery statement, and if not, store the table structure information in the FROM into the table structure information list TableList, and add the connection field to the constant expression list WhereList. If there is a subquery statement in the JOIN connection, it is classified as a subquery algorithm.
[0062] The embodiment of the present application automatically extracts conditional statements and table query statements in SQL query statements based on the analysis of the result tree, generates a constant expression list and a table structure information list, thereby achieving the effect of improving SQL query processing efficiency and reducing manual intervention.
[0063] In order to accurately judge the conditional statements, optionally, in the database performance testing method provided in the embodiment of the present application, known constant expressions are identified from all conditional statements, and the identified known constant expressions are stored in a constant expression list, including: for each conditional statement, the type of the expression is recursively determined, and when an expression containing the and condition is identified, the expressions on the left and right sides of the and condition are continued to be recursively determined; when an expression containing the or condition is identified, if both the left and right sides of the or condition are constant expressions, the or condition is added to the constant expression list; when a basic expression is identified, if both the left and right sides of the basic expression are constant expressions, the basic expression is added to the constant expression list.
[0064] Specifically, the process can be understood as the system traversing all conditional statements and recursively determining the type of each expression. If a condition containing "and" is encountered, the two sides of the condition will continue to be recursively determined; if a condition containing "or" is encountered, and both sides are constants, the condition will be added to the list of constant expressions; if it is a basic expression (such as =, >, etc.), and both sides are constants, it will also be added to the list of constant expressions. This method ensures that all known constant conditions can be identified and recorded.
[0065] The identification and recursive method of constant expressions is as follows: the constants in the constant expressions are stored in the constant expression list WhereList through the constant recursive algorithm. The constant recursive algorithm is to analyze the AND and OR conditions one by one to determine whether the WHERE expression is AND or OR. If it is an AND expression, it is skipped when the left side of the AND expression is an OR expression, otherwise the expressions on the left and right sides of the AND expression are reassigned for recursive judgment. If it is an OR expression, it is determined whether the left side of the OR expression is a constant expression. If so, it is determined whether the right side of the OR expression is a constant expression. If so, the OR expression is added to the WhereList and yes is returned, otherwise no is returned. Yes and no represent whether the connection between constant expressions is and or or. Then determine which basic (=, >, >=, <, <=, !=, IN, etc.) expression the expression belongs to, and then determine whether it is a constant expression by the types of the left and right sides. If so, yes is returned, otherwise no is returned.
[0066] The embodiment of the present application achieves the effect of automatically identifying and effectively collecting constant conditions in SQL queries by recursively judging various expressions in conditional statements and extracting constants.
[0067] In order to query unknown parameters in a statement, optionally, in the database performance testing method provided in an embodiment of the present application, querying the value of an unknown parameter based on a constant expression list and a table structure information list includes: concatenating a structured query statement through a table structure information list and a constant expression list; taking the value of the unknown parameter as content to be queried, executing the concatenated structured query statement in a first database, and obtaining a query result of the content to be queried; when the query result is not empty, determining the query result as the value of the unknown parameter; when the query result is empty, determining an empty string as the value of the unknown parameter.
[0068] Specifically, when querying unknown parameters, a complete SOL query statement is generated using a constant expression list and a table structure information list. The generated query statement is executed in the first database. If the query result obtained is not empty, it means that the value of the unknown parameter can be queried, and the result is used as the value of the unknown parameter; if the query result is empty, it means that the value of the unknown parameter is not stored in the queryable table, and the value of the unknown parameter is set to an empty string.
[0069] The embodiment of the present application achieves the effect of automatically completing unknown parameters and improving the completeness and execution efficiency of the query by splicing structured query statements based on a constant expression list and a table structure information list, and executing an unknown parameter query.
[0070] In order to calculate the query rate per second of each thread and determine the first and second execution parameters, optionally, in the database performance testing method provided in the embodiment of the present application, a target structured query statement is executed in the first database, and the execution parameters are calculated to obtain the first execution parameter, including: executing multiple target structured query statements concurrently according to N threads in the first database, and calculating the query rate per second of each thread, and determining the maximum query rate per second among the N threads as the first execution parameter; executing the target structured query statement in the second database and calculating the execution parameters to obtain the second execution parameter includes: executing multiple target structured query statements concurrently according to N threads in the second database, and calculating the query rate per second of each thread, and determining the maximum query rate per second among the N threads as the second execution parameter.
[0071] Specifically, the high-concurrency and concurrent execution performance test of SQL statements requires two parameters, one is the number of concurrent executions N, and the other is the execution time T. Both parameters can be set when executing the test.
[0072] When performing performance testing, the steps may include:
[0073] First, set the number of concurrent executions N and the execution time T; then loop to add threads to N, and each thread executes separately: execute the same SQL statement, the execution time of each thread is T, count the execution time for each transaction, and calculate QPS (Queries-per-second) after returning every 100 execution results. The calculation formula is as follows:
[0074]
[0075] QPS is the query rate per second, n and t are the number of concurrent executions N and execution time T;
[0076] After all N threads are finished, the maximum QPS is compared and taken as the final QPS of the SQL:
[0077] QPS=MAX(QPS1,QPS2…,QPS N )
[0079] Figure 5 is a flowchart of automatic execution of structured query statements provided in an embodiment of the present application, such as Figure 5 As shown, the module includes a cron task module, a task table, the execution time of the SQL to be executed, and the query rate per second (QPS, Queries-per-second) of execution.
[0080] The cron task module is responsible for periodically triggering a series of tasks, including scanning the task table, concurrently executing SQL, and updating the execution results. The task table stores the SQL statements to be executed, which serves as the core data structure for task management. The query rate per second of the SQL to be executed is an indicator to measure the processing capacity of the database or server, which indicates how many query requests the system can handle in one second. QPS is usually used to evaluate the performance of database systems, especially in high-concurrency scenarios.
[0081] Figure 6 is a statistical graph of query rate per second provided according to an embodiment of the present application, such as Figure 6 As shown, the curves in the figure are the difference comparison evaluation of the QPS of SQL execution before transformation and the QPS of SQL execution after transformation. SOURCE_QPS_MAX represents the QPS of SQL execution before transformation, and DEST QPS_MAX represents the QPS of SQL execution after transformation.
[0082] In actual development and production, when the developer checks the task attribute database transformation in the task item, the developer configures the corresponding comparison database device information and the SQL to be compared, and the background triggers the SQL comparison. The comparison system automatically executes each SQL in sequence in the background. After the execution is completed, the developer can view and export the comparison results in the task item for difference evaluation.
[0083] The embodiment of the present application uses multiple threads in the first database and the second database to concurrently execute queries and calculate the maximum query rate per second, thereby evaluating the performance of the database in a high-concurrency scenario and facilitating a direct comparison of the performance of the database before and after the transformation.
[0084] In order to accurately obtain the maximum query rate per second of N threads, optionally, in the database performance testing method provided in the embodiment of the present application, multiple target structured query statements are concurrently executed according to N threads in the first database, and the query rate per second of each thread is calculated, including: importing all generated target structured query statements into the task table; using batch tasks to scan the task table at preset time intervals, and when a new target structured query statement is scanned, executing the new target structured query statement concurrently according to N threads in the first database; updating the maximum query rate per second of the N threads according to the execution time of the new target structured query statement, and storing the updated maximum query rate per second in the task table.
[0085] Specifically, all generated target SOL query statements are stored in the task table, and multiple SQL tasks can be managed and scheduled uniformly. In this way, during testing, queries to be executed can be centrally stored in a task table, and new tasks that need to be processed can be checked regularly. When new tasks are found, these SQL queries are executed concurrently with N threads. Concurrent execution can process a large number of query requests faster and simulate high-concurrency scenarios.
[0086] The query rate per second of each thread is calculated, and the maximum query rate per second is recorded in the task table. The purpose is to find the best performance of the system in concurrent execution, so as to compare the processing capabilities of the database in different situations.
[0087] The embodiment of the present application achieves the effect of automatically processing query tasks and continuously optimizing database execution efficiency through batch task scanning and multi-threaded concurrent query execution.
[0088] Figure 7 is a schematic diagram of an automatic parameter filling algorithm provided according to an embodiment of the present application, the automatic parameter filling algorithm is used to supplement the unknown parameters of the conditional statement in the structured query statement to make the structured query statement executable, such as Figure 7As shown, the steps of the automatic parameter filling algorithm include storing the identified known constant expressions into a constant expression list, storing the identified table structure information into a table structure information list, determining the query result as the value of the unknown parameter when the query result is not empty, and determining an empty string as the value of the unknown parameter when the query result is empty.
[0089] The contents of the automatic parameter filling algorithm include:
[0090] 1. Parsing algorithm: query parsing algorithm DealSelect(), parse statement type and content;
[0091] Specifically, the types of parsing algorithms include: SELECT, FROM, WHERE, and LIMIT.
[0092] When processing the SELECT part, determine whether there is a subquery class in the select part. If not, it ends directly without filling in parameters. Otherwise, further processing is required. If there is a subquery, it is classified as a subquery algorithm.
[0093] When processing the FROM part, determine whether there is a JOIN connection in the FROM part. If not, store the table TABLE in the FROM in the temporary list TableList. If there is a JOIN connection, further determine whether the JOIN connection has a subquery. If not, store the table TABLE in the FROM in the temporary list TableList and add the connection field to the constant expression list WhereList. If there is a subquery in the JOIN connection, it is classified as a subquery algorithm.
[0094] When processing the WHERE part, first use the constant recursive algorithm to count all known conditions in the WHERE part and store them in the temporary constant list WhereList. Use the where recursive algorithm to analyze the AND and OR conditions one by one, and combine them with the constant list WhereList to perform the parameter filling algorithm.
[0095] When processing the LIMIT part, check whether LIMIT exists. If it does, just assign a value of 1000. If not, continue to the next part.
[0096] 2. Subquery recursive algorithm: Determine whether there is a subquery statement in the statement. If so, continue recursion. If not, call the parsing algorithm to parse the statement;
[0097] 3. Constant expression recursive algorithm: Connect symbols according to constant expressions and recurse constant expressions; the final result is stored in the constant expression list and table structure information list.
[0098] Specifically, identifying known constant expressions from all conditional statements, and storing the identified known constant expressions in a constant expression list includes: storing constants in the constant expression in a constant expression list WhereList through a constant recursive algorithm. The constant recursive algorithm is to analyze AND and OR conditions one by one to determine whether the WHERE expression is AND or OR. If it is an AND expression, it is skipped when the left side of the AND expression is an OR expression, otherwise the expressions on the left and right sides of the AND expression are reassigned for recursive judgment. If it is an OR expression, it is determined whether the left side of the OR expression is a constant expression. If so, it is determined whether the right side of the OR expression is a constant expression. If so, the OR expression is added to the WhereList and yes is returned, otherwise no is returned. Yes and no represent whether the connection between constant expressions is and or or. Then determine which basic (=, >, >=, <, <=, !=, IN, etc.) expression the expression belongs to, and then determine whether it is a constant expression by the types of the left and right sides. If so, yes is returned, otherwise no is returned.
[0099] 4. WHERE recursive algorithm: recursively apply the expressions on both sides of the expression, including:
[0100] First, determine whether the WHERE expression is AND or OR. If it is an AND expression or an OR expression, reassign the expressions on the left and right sides of the expression for recursive determination. If it is not an AND or OR expression, perform the parameter filling algorithm.
[0101] 5. Filling parameter algorithm: concatenate structured query statements and assign values to the initial structured query statements;
[0102] Specifically, the temporary lists WhereList and TableList are reassembled into a new SQL statement, and the fields that need to be filled in are used as query results to query the actual result data through the actual database. After obtaining the actual data, the value is assigned to the original SQL statement. If it returns empty, an empty string is assigned. This continues until the filling in of parameters is completed.
[0103] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0104] Example 2
[0105] The embodiment of the present application also provides a database performance testing device. It should be noted that the database performance testing device of the embodiment of the present application can be used to execute the database performance testing method provided by the embodiment of the present application. The database performance testing device provided by the embodiment of the present application is introduced below.
[0106] According to an embodiment of the present application, a device for implementing the above database performance testing method is also provided. Figure 8 is a schematic diagram of a database performance testing device provided according to an embodiment of the present application, such as Figure 8 As shown, the device comprises:
[0107] The statement parsing module 801 is used to parse the initial structured query statement in the first database and supplement the unknown parameters of the conditional statement in the parsing result to obtain the target structured query statement, wherein the first database is a database transformed from the second database;
[0108] A first execution parameter calculation module 802 is used to execute the target structured query statement in the first database and calculate the execution parameter to obtain the first execution parameter;
[0109] A second execution parameter calculation module 803 is used to execute the target structured query statement in the second database and calculate the execution parameter to obtain a second execution parameter;
[0110] The performance determination module 804 is used to determine the execution performance of the first database according to the first execution parameter and the second execution parameter.
[0111] In the embodiment of the present application, the statement parsing module 801 parses the initial structured query statement in the first database, and supplements the unknown parameters of the conditional statement in the parsing result to obtain the target structured query statement, wherein the first database is a database obtained by transformation from the second database; the first execution parameter calculation module 802 executes the target structured query statement in the first database, and calculates the execution parameter to obtain the first execution parameter; the second execution parameter calculation module 803 executes the target structured query statement in the second database, and calculates the execution parameter to obtain the second execution parameter; the performance determination module 804 determines the execution performance of the first database according to the first execution parameter and the second execution parameter. By parsing the initial structured query statement and automatically filling in the unknown parameters, the first execution parameter is the parameter in the statement to be executed by the database after the transformation, and the second execution parameter is the parameter in the statement to be executed by the database before the transformation, the purpose of simplifying the test process and eliminating the tedious operation of filling in individual parameters is achieved, thereby achieving the technical effect of fully automated SQL performance testing after database transformation, thereby solving the problem of difficulty in performance testing after database transformation in related technologies.
[0112] It should be noted that the above modules correspond to the steps in Example 1, and the examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above Example 1. It should be noted that the above modules or units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules may also be part of the device and may be run in the computer terminal 10 provided in Example 1.
[0113] Optionally, in the database performance testing device provided in the embodiment of the present application, the statement parsing module 801 includes: a result tree determination module, which is used to use a parser to parse the structured query statement to obtain a result tree, wherein the result tree includes multiple levels of data, and the data in each level includes at least one of the following: conditional statements, table query statements, column query statements, and restriction statements; a list generation module, which is used to generate a constant expression list and a table structure information list based on the data in the result tree; an unknown parameter identification module, which is used to identify unknown parameters from all conditional statements in the result tree; an unknown parameter query module, which is used to query the value of an unknown parameter based on the constant expression list and the table structure information list; a structured query statement determination module, which is used to fill the value of the unknown parameter into the initial structured query statement to obtain a target structured query statement.
[0114] Optionally, in the database performance testing device provided in the embodiment of the present application, the list generation module includes: a statement acquisition module, used to obtain all conditional statements and all table query statements from the result tree; a first identification module, used to identify known constant expressions from all conditional statements, and store the identified known constant expressions in a constant expression list; a second identification module, used to identify known constant expressions and table structure information from all table query statements, store the identified known constant expressions in the constant expression list, and store the identified table structure information in the table structure information list.
[0115] Optionally, in the database performance testing device provided in the embodiment of the present application, the first identification module includes: a recursive judgment module, which is used to recursively judge the type of expression for each conditional statement, and when an expression containing the and condition is identified, continue to recursively judge the expressions on both sides of the and condition; a first expression adding module, which is used to add the or condition to the constant expression list when an expression containing the or condition is identified, if both sides of the or condition are constant expressions; and a second expression adding module, which is used to add the basic expression to the constant expression list when a basic expression is identified, if both sides of the basic expression are constant expressions.
[0116] Optionally, in the database performance testing device provided in the embodiment of the present application, the unknown parameter query module includes: a structured query statement splicing module, which is used to splice structured query statements through a table structure information list and a constant expression list; an unknown parameter query sub-module, which is used to use the value of the unknown parameter as the content to be queried, execute the spliced structured query statement in the first database, and obtain the query result of the content to be queried; a first unknown parameter determination module, which is used to determine the query result as the value of the unknown parameter when the query result is not empty; and a second unknown parameter determination module, which is used to determine an empty string as the value of the unknown parameter when the query result is empty.
[0117] Optionally, in the database performance testing device provided in the embodiment of the present application, the first execution parameter calculation module 802 includes: a first execution parameter determination module, which is used to concurrently execute multiple target structured query statements according to N threads in the first database, and calculate the query rate per second of each thread, and determine the maximum query rate per second among the N threads as the first execution parameter; the second execution parameter calculation module 803 includes: a second execution parameter determination module, which is used to concurrently execute multiple target structured query statements according to N threads in the second database, and calculate the query rate per second of each thread, and determine the maximum query rate per second among the N threads as the second execution parameter.
[0118] Optionally, in the database performance testing device provided in the embodiment of the present application, the first execution parameter determination module includes: an import module, used to import all generated target structured query statements into the task table; a concurrent execution module, used to use batch tasks to scan the task table at preset time intervals, and when a new target structured query statement is scanned, concurrently execute the new target structured query statement in the first database according to N threads; a maximum query rate per second update module, used to update the maximum query rate per second of N threads according to the execution time of the new target structured query statement, and store the updated maximum query rate per second in the task table.
[0119] Example 3
[0120] An embodiment of the present application may provide an electronic device, Fig. 9 is a structural block diagram of an electronic device according to an embodiment of the present application. Fig. 9 As shown, the electronic device may include: one or more ( Fig. 9 (only one is shown) processor 902, memory 904, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0121] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0122] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: parse the initial structured query statement in the first database, and supplement the unknown parameters of the conditional statement in the parsing result to obtain the target structured query statement, wherein the first database is a database transformed from the second database; execute the target structured query statement in the first database, and calculate the execution parameters to obtain the first execution parameters; execute the target structured query statement in the second database, and calculate the execution parameters to obtain the second execution parameters; determine the execution performance of the first database based on the first execution parameters and the second execution parameters.
[0123] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: parsing the initial structured query statement in the first database, and supplementing the unknown parameters of the conditional statement in the parsing result to obtain the target structured query statement, including: using a parser to parse the structured query statement to obtain a result tree, wherein the result tree includes multiple levels of data, and the data in each level includes at least one of the following: conditional statements, table query statements, column query statements, and restriction statements; generating a constant expression list and a table structure information list based on the data in the result tree; identifying unknown parameters from all conditional statements in the result tree; querying the value of the unknown parameter based on the constant expression list and the table structure information list; filling the value of the unknown parameter into the initial structured query statement to obtain the target structured query statement.
[0124] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: generating a constant expression list and a table structure information list based on the data in the result tree, including: obtaining all conditional statements and all table query statements from the result tree; identifying known constant expressions from all conditional statements, and storing the identified known constant expressions in the constant expression list; identifying known constant expressions and table structure information from all table query statements, storing the identified known constant expressions in the constant expression list, and storing the identified table structure information in the table structure information list.
[0125] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: identify known constant expressions from all conditional statements, and store the identified known constant expressions in a constant expression list, including: for each conditional statement, recursively determine the type of expression, and when an expression containing the and condition is identified, continue to recursively determine the expressions on the left and right sides of the and condition; when an expression containing the or condition is identified, if both the left and right sides of the or condition are constant expressions, add the or condition to the constant expression list; when a basic expression is identified, if both the left and right sides of the basic expression are constant expressions, add the basic expression to the constant expression list.
[0126] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: querying the value of the unknown parameter based on the constant expression list and the table structure information list includes: splicing the structured query statement through the table structure information list and the constant expression list; taking the value of the unknown parameter as the content to be queried, executing the spliced structured query statement in the first database, and obtaining the query result of the content to be queried; when the query result is not empty, determining the query result as the value of the unknown parameter; when the query result is empty, determining the empty string as the value of the unknown parameter.
[0127] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: executing the target structured query statement in the first database and calculating the execution parameter, and obtaining the first execution parameter includes: concurrently executing multiple target structured query statements according to N threads in the first database, and calculating the query rate per second of each thread, and determining the maximum query rate per second among the N threads as the first execution parameter; executing the target structured query statement in the second database and calculating the execution parameter, and obtaining the second execution parameter includes: concurrently executing multiple target structured query statements according to N threads in the second database, and calculating the query rate per second of each thread, and determining the maximum query rate per second among the N threads as the second execution parameter.
[0128] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: concurrently executing multiple target structured query statements according to N threads in the first database, and calculating the query rate per second of each thread, including: importing all generated target structured query statements into the task table; using batch tasks to scan the task table at preset time intervals, and when a new target structured query statement is scanned, concurrently executing the new target structured query statement according to N threads in the first database; updating the maximum query rate per second of the N threads according to the execution time of the new target structured query statement, and storing the updated maximum query rate per second in the task table.
[0129] In an embodiment of the present application, the initial structured query statement in the first database is parsed, and the unknown parameters of the conditional statement in the parsing result are supplemented to obtain the target structured query statement, wherein the first database is a database transformed from the second database; the target structured query statement is executed in the first database, and the execution parameters are calculated to obtain the first execution parameters; the target structured query statement is executed in the second database, and the execution parameters are calculated to obtain the second execution parameters; the execution performance of the first database is determined according to the first execution parameters and the second execution parameters. By parsing the initial structured query statement and automatically filling in the unknown parameters, the first execution parameter is the parameter in the statement to be executed by the database after the transformation, and the second execution parameter is the parameter in the statement to be executed by the database before the transformation, the purpose of simplifying the test process and eliminating the tedious operation of filling in the dynamic parameters separately is achieved, thereby achieving the technical effect of fully automated SQL performance testing after database transformation, and thus solving the problem of difficulty in database performance testing after transformation in related technologies.
[0130] It can be understood by those skilled in the art that Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone, a tablet computer, a PDA, a mobile Internet device (MID), a PAD or other terminal device. Fig. 9 The structure of the electronic device is not limited. Fig. 9 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Fig. 9 Different configurations shown.
[0131] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0132] Example 4
[0133] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the database performance testing method provided in the first embodiment.
[0134] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0135] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program steps of the database performance testing method.
[0136] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0137] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0138] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0139] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0140] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0141] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0142] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A database performance testing method, characterized in that: include: Parsing an initial structured query statement in a first database, and supplementing unknown parameters of a conditional statement in a parsing result to obtain a target structured query statement, wherein the first database is a database transformed from the second database; Executing the target structured query statement in the first database and calculating execution parameters to obtain first execution parameters; Executing the target structured query statement in the second database and calculating execution parameters to obtain second execution parameters; The execution performance of the first database is determined according to the first execution parameter and the second execution parameter.
2. The database performance testing method according to claim 1, characterized in that: Parsing the initial structured query statement in the first database and supplementing the unknown parameters of the conditional statement in the parsing result to obtain the target structured query statement includes: The structured query statement is parsed by a parser to obtain a result tree, wherein the result tree includes data at multiple levels, and the data at each level includes at least one of the following: a conditional statement, a table query statement, a column query statement, and a restriction statement; Generate a constant expression list and a table structure information list based on the data in the result tree; identifying unknown parameters from all of the conditional statements in the result tree; Querying the value of the unknown parameter based on the constant expression list and the table structure information list; The value of the unknown parameter is filled into the initial structured query statement to obtain the target structured query statement.
3. The database performance testing method according to claim 2, characterized in that: Generating a constant expression list and a table structure information list based on the data in the result tree includes: Obtaining all of the conditional statements and all of the table query statements from the result tree; Identify known constant expressions from all of the conditional statements, and store the identified known constant expressions in a constant expression list; Identify known constant expressions and table structure information from all of the table query statements, store the identified known constant expressions in a constant expression list, and store the identified table structure information in a table structure information list.
4. The database performance testing method according to claim 3, characterized in that: Identifying known constant expressions from all of the conditional statements and storing the identified known constant expressions in a constant expression list includes: For each conditional statement, recursively determine the type of the expression. When an expression containing an AND condition is identified, continue to recursively determine the expressions on both sides of the AND condition. When an expression containing an OR condition is identified, if both the left and right sides of the OR condition are constant expressions, the OR condition is added to the constant expression list; When a basic expression is identified, if both the left and right sides of the basic expression are constant expressions, the basic expression is added to the constant expression list.
5. The database performance testing method according to claim 2, characterized in that: Querying the value of the unknown parameter based on the constant expression list and the table structure information list includes: splicing a structured query statement through the table structure information list and the constant expression list; Taking the value of the unknown parameter as the content to be queried, executing the concatenated structured query statement in the first database to obtain a query result of the content to be queried; If the query result is not empty, determining the query result as the value of the unknown parameter; When the query result is empty, an empty string is determined as the value of the unknown parameter.
6. The database performance testing method according to claim 1, characterized in that: Executing the target structured query statement in the first database and calculating execution parameters, the first execution parameters obtained include: Concurrently executing the plurality of target structured query statements according to N threads in the first database, calculating the query per second rate of each thread, and determining the maximum query per second rate among the N threads as the first execution parameter; Executing the target structured query statement in the second database and calculating execution parameters, the second execution parameters obtained include: In the second database, multiple target structured query statements are concurrently executed according to N threads, and the query rate per second of each thread is calculated, and the maximum query rate per second among the N threads is determined as the second execution parameter.
7. The database performance testing method according to claim 6, characterized in that: Concurrently executing the plurality of target structured query statements according to N threads in the first database and calculating the query rate per second of each thread includes: Importing all the generated target structured query statements into the task table; Scanning the task table at preset intervals using batch tasks, and when a newly added target structured query statement is scanned, executing the newly added target structured query statement concurrently in the first database according to the N threads; The maximum query rate per second of the N threads is updated according to the execution time of the newly added target structured query statement, and the updated maximum query rate per second is stored in the task table.
8. A database performance testing device, characterized in that: include: A statement parsing module, used to parse an initial structured query statement in a first database, and to supplement unknown parameters of a conditional statement in a parsing result to obtain a target structured query statement, wherein the first database is a database transformed from the second database; A first execution parameter calculation module, used to execute the target structured query statement in the first database and calculate execution parameters to obtain first execution parameters; A second execution parameter calculation module, used to execute the target structured query statement in the second database and calculate the execution parameter to obtain a second execution parameter; A performance determination module is used to determine the execution performance of the first database according to the first execution parameter and the second execution parameter.
9. A computer program product, characterized in that It comprises a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the database performance testing method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to execute the database performance testing method according to any one of claims 1 to 7 through the computer program.