Data report performance adjusting and optimizing method and device, electronic equipment and storage medium
By adjusting the display scope of data reports, optimizing query statements, optimizing database replacement and optimizing the display logic of data reports, the problem of low report query efficiency is solved, and query efficiency and operation and maintenance efficiency are significantly improved.
Patent Information
- Application Number
- CN202411867109.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-25
AI Technical Summary
In the prior art, when operation and maintenance personnel query large amounts of monitoring data, the report query efficiency is low and slow, resulting in low patrol efficiency.
By obtaining reports to be tuned, adjusting their data display range, optimizing query statements, filtering target databases, replacing the original database, optimizing display logic, and gradually improving report query efficiency.
It effectively shortens the report query time, improves the report query efficiency and the operation and maintenance personnel's efficiency in troubleshooting.
Smart Images

Figure CN119690947A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and device for optimizing data report performance, an electronic device, and a storage medium. Background Art
[0002] With the rapid development of banking financial technology, the number of monitoring items of various systems in banks is also increasing. In order to improve the daily inspection efficiency of operation and maintenance personnel, in the existing technology, reports are prepared to view the aggregated monitoring operation data.
[0003] However, due to the large amount of monitoring data and high timeliness, when operation and maintenance personnel query a large amount of monitoring data through reports, there will be problems of low query efficiency and slow speed. Therefore, it is urgent to solve the problem of low report query efficiency. Summary of the invention
[0004] Based on the above-mentioned deficiencies of the prior art, the present application provides a method and device for tuning data report performance, an electronic device, and a storage medium to solve the problem of low report query efficiency caused by the prior art.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] The first aspect of the present application provides a method for tuning data report performance, comprising:
[0007] Get the report to be tuned;
[0008] Adjust the data display range of the report to be optimized;
[0009] Optimize the query statements of the adjusted report to be optimized and obtain the query results;
[0010] Filtering out a target database that meets the data characteristics of the query result from the database, and replacing the database used by the query result with the target database in the adjusted report to be optimized, to obtain a target report;
[0011] When the replacement is completed, the display logic of the target report is optimized to obtain an optimized report.
[0012] Optionally, in the above-mentioned method for optimizing data report performance, adjusting the data display range of the report to be optimized includes:
[0013] Obtaining the display time range of the report to be optimized sent by the user;
[0014] Determine whether the setting of the display time range meets the preset requirements;
[0015] If the setting of the display time range does not meet the preset requirements, the display time range is adjusted to adjust the data display range of the report to be optimized.
[0016] Optionally, in the above-mentioned data report performance tuning method, the step of optimizing query statements of the adjusted report to be tuned includes:
[0017] Obtain multiple query statements of the report to be optimized;
[0018] For each query statement, determine whether there is an index on the field used for query, connection and sorting by the query statement;
[0019] If there is an index on the field used by the query statement for query, connection and sorting, check whether the query statement meets the specification requirements;
[0020] If the query statement meets the specification requirements, determine whether the query data volume corresponding to the query statement is greater than a preset threshold;
[0021] If the query data volume corresponding to the query statement is greater than a preset threshold, the query data volume corresponding to the query statement is limited by using a LIMIT function to obtain a limited data volume corresponding to the query statement, and the limited data volume corresponding to the query statement is determined as a query result;
[0022] If the amount of query data corresponding to the query statement is less than a preset threshold, detecting whether there is a multi-table associated query in the query statement;
[0023] If there is a multi-table associated query in the query statement, determine whether the query statement performs an associated query according to the principle of a small table driving a large table;
[0024] If the query statement does not perform associated query according to the principle of small table driving large table, the query statement of the report to be optimized is optimized to obtain the query result.
[0025] Optionally, in the above-mentioned data report performance tuning method, after the replacement is completed, the display logic of the target report is optimized to obtain a tuned report, including:
[0026] When the replacement is completed, the display logic of the target report is optimized in the form of preloading to obtain an optimized report.
[0027] Optionally, in the above data report performance tuning method, the following steps are further included:
[0028] Get query instructions;
[0029] Obtaining target data corresponding to the query instruction from the tuning report, and recording the response time of obtaining the target data;
[0030] Detecting whether the response time is less than a preset threshold;
[0031] If the response time is less than the preset threshold, it is determined that the tuning report is successfully tuned, and the target data is fed back.
[0032] A second aspect of the present application provides a data report performance tuning device, comprising:
[0033] The acquisition unit is used to obtain the report to be tuned;
[0034] An adjustment unit, used to adjust the data display range of the report to be optimized;
[0035] The query optimization unit is used to optimize the query statement of the adjusted report to be optimized to obtain the query result;
[0036] A replacement unit, configured to select a target database that meets the data characteristics of the query result from the database, and replace the database used by the query result with the target database in the adjusted report to be optimized, so as to obtain a target report;
[0037] The optimization unit is used to optimize the display logic of the target report after the replacement is completed to obtain an optimized report.
[0038] Optionally, in the above-mentioned data report performance tuning device, the tuning unit includes:
[0039] A time acquisition unit, used to acquire a display time range of the report to be optimized sent by a user;
[0040] A time judgment unit, used to judge whether the setting of the display time range meets the preset requirements;
[0041] The adjusting subunit is used to adjust the display time range if the setting of the display time range does not meet the preset requirements, so as to adjust the data display range of the report to be optimized.
[0042] Optionally, in the above-mentioned data report performance tuning device, the query optimization unit includes:
[0043] A statement acquisition unit, used to acquire multiple query statements of the report to be optimized;
[0044] A first judgment unit is used to judge, for each of the query statements, whether there is an index on the field used for querying, connecting and sorting in the query statement;
[0045] A checking unit, configured to check whether the query statement meets specification requirements if an index exists on the fields used for querying, connecting and sorting by the query statement;
[0046] A second judgment unit is used to judge whether the amount of query data corresponding to the query statement is greater than a preset threshold if the query statement meets the specification requirements;
[0047] a limiting unit, configured to limit the query data amount corresponding to the query statement by using a LIMIT function if the query data amount corresponding to the query statement is greater than a preset threshold, to obtain a limited data amount corresponding to the query statement, and determine the limited data amount corresponding to the query statement as a query result;
[0048] A relationship detection unit, configured to detect whether there is a multi-table association query in the query statement if the amount of query data corresponding to the query statement is less than a preset threshold;
[0049] An association judgment unit, used for judging whether the query statement performs an association query according to the principle of a small table driving a large table if there is a multi-table association query in the query statement;
[0050] The sub-query optimization unit is used to optimize the query statement of the report to be optimized to obtain the query result if the query statement does not perform the associated query according to the principle of the small table driving the large table.
[0051] Optionally, in the above-mentioned data report performance tuning device, the optimization unit includes:
[0052] The optimization subunit is used to optimize the display logic of the target report in a preloaded form after the replacement is completed to obtain an optimized report.
[0053] Optionally, the above-mentioned data report performance tuning device further includes:
[0054] An instruction acquisition unit, used for acquiring a query instruction;
[0055] A recording unit, used to obtain target data corresponding to the query instruction from the tuning report, and record the response time of obtaining the target data;
[0056] A third detection unit, used to detect whether the response time is less than a preset threshold;
[0057] A feedback unit is used to determine that the tuning of the tuning report is successful if the response time is less than the preset threshold, and to feed back the target data.
[0058] A third aspect of the present application provides an electronic device, including:
[0059] Memory and processor;
[0060] Wherein, the memory is used to store programs;
[0061] The processor is used to execute the program, and when the program is executed, it is specifically used to implement a method for tuning data report performance as described in any one of the above items.
[0062] A sixth aspect of the present application provides a method for storing a computer program, which, when executed, is used to implement a method for tuning data report performance as described in any one of the above.
[0063] The present application provides a method for tuning the performance of a data report, which obtains the report to be tuned, adjusts the data display range of the report to be tuned, optimizes the query statement of the adjusted report to be tuned, obtains the query result, and then screens out the target database that meets the data characteristics of the query result from the database, and replaces the database used for the query result with the target database in the adjusted report to be tuned to obtain the target report, and finally, after the replacement is completed, optimizes the display logic of the target report to obtain the tuned report. Thus, by reducing the amount of query data, optimizing queries, replacing databases, and optimizing display logic for the report to be tuned, the query time of the report to be tuned can be effectively shortened, thereby effectively improving the query efficiency of the report and the efficiency of troubleshooting by operation and maintenance personnel. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0065] Figure 1 A flowchart of a method for optimizing data report performance provided in an embodiment of the present application;
[0066] Figure 2 A flowchart of a method for adjusting default data provided in an embodiment of the present application;
[0067] Figure 3 A flowchart of a method for obtaining query results provided in an embodiment of the present application;
[0068] Figure 4 A flowchart of a method for detecting a tuning report is provided for another embodiment of the present application;
[0069] Figure 5A schematic diagram of the structure of a data report performance tuning device provided in another embodiment of the present application;
[0070] Figure 6 A schematic diagram of the structure of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0071] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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 are within the scope of protection of this application.
[0072] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0073] The present application embodiment provides a method for optimizing data report performance, such as Figure 1 As shown, the specific steps include:
[0074] S101. Obtain the report to be optimized.
[0075] It is understandable that since a large amount of operation and maintenance process data is stored in the report, the operation and maintenance personnel need to query the report to know whether the application system is abnormal. However, if a large amount of data is queried in the report at the same time, it will lead to low query efficiency and slow response speed. Therefore, the report needs to be tuned to improve the query efficiency and response efficiency of the report. Therefore, optionally, the report to be tuned can be obtained from the report database to learn the data range, data volume, and default display method and logic involved in the report to be tuned, so as to better optimize.
[0076] S102. Adjust the data display range of the report to be optimized.
[0077] It is understandable that since the operation and maintenance personnel will check whether there are any abnormal indicators in the application system at regular intervals, excessive query time will cause the data volume to double and the query efficiency to slow down, and some invalid data will also be added. For example, the operation and maintenance personnel query 7 days of data by default, but there are 300,000 records on a page, and most of the data will be irrelevant to the purpose of the operation and maintenance personnel's query this time, and the cause of the monitoring system failure will usually appear in the monitoring indicators of the past 24 hours. Therefore, it is necessary to adjust the data display range of the report to be tuned, so that in the subsequent query process, the scale of the queried data will be smaller, thereby reducing the query time and resource consumption.
[0078] Optionally, in another embodiment of the present application, a specific implementation of step S102 is as follows: Figure 2 As shown, the following steps are included:
[0079] S201. Obtain a display time range of a report to be optimized sent by a user.
[0080] It is understandable that in order to provide effective information to operation and maintenance personnel and reduce the amount of data query, operation and maintenance personnel can send the display time range of the report to be optimized through the sending interface provided by the system, so that the subsequent system can reduce the query time and resource consumption according to the display time of the report to be optimized.
[0081] S202: Determine whether the setting of the display time range meets the preset requirements.
[0082] Specifically, if the setting of the display time range meets the preset requirements, step S203 is executed.
[0083] Optionally, if the setting of the display time range meets the preset requirements, the data display range of the report to be optimized is not adjusted, and step S103 is directly executed.
[0084] S203: Adjust the display time range to adjust the data display range of the report to be optimized.
[0085] Specifically, when the setting of the display time range does not meet the preset requirements, the display time range is adjusted according to the user's requirements and actual usage scenarios, so that the data display range of the report to be optimized is adjusted according to the adjusted display time range.
[0086] In addition, in addition to shortening the data volume based on the time range of the data, it can also be shortened based on the analytical value of the data. If the analytical value of the data is not great, it is filtered out from the default data. If the analytical value of the data is great, the data is retained.
[0087] S103: Optimize the query statement of the adjusted report to be optimized to obtain the query result.
[0088] It should be noted that based on the report to be optimized after adjusting the time limit, the query SQL is optimized, that is, through the structure of the query statement, the use of indexes, the optimization of conditions, etc., the query can be made more efficient, and then the database can locate and obtain the required data more quickly when executing the query, further shortening the query time.
[0089] Optionally, in another embodiment of the present application, a specific implementation of step S103 is as follows: Figure 3 As shown, the following steps are included:
[0090] S301. Obtain multiple query statements of the report to be optimized.
[0091] It is understandable that in order for the database to locate and obtain the required data more quickly when executing a query and further shorten the query time, it is necessary to optimize the query statement structure, the use of indexes, conditions, etc. to make the query more efficient, so it is necessary to pre-acquire multiple query statements for the report to be tuned.
[0092] S302: for each query statement, determine whether there is an index on the fields used for querying, connecting and sorting in the query statement.
[0093] It is understandable that an index is a data structure used for fast query and retrieval of data. For a table with a large amount of query data, establishing an index can greatly improve the efficiency of the query, so it is necessary to determine whether there is an index on the fields used by the query statement for query, connection and sorting, that is, whether there is an index on the fields used by the query statement for query, connection and sorting. If there is an index on the fields used by the query statement for query, connection and sorting, step S303 is executed.
[0094] Optionally, if no index exists on the fields used by the query statement for query, connection, and sorting, you need to build an index based on the query statement and then execute to check whether the query statement meets the specification requirements.
[0095] S303: Check whether the query statement complies with specification requirements.
[0096] Specifically, in order to ensure data accuracy and improve performance, the query statement needs to specify the field name. This not only helps to improve the accuracy and readability of the query, but also avoids unnecessary reading and processing of unnecessary field data, thereby reducing the amount of data transmission and processing. It works together with the establishment of the correct index to make the query more targeted and efficient.
[0097] In addition, when writing the join SQL, sometimes the join condition is omitted in the query statement, sometimes all rows in the two reports meet the join condition, and sometimes the join condition in the query statement is invalid. Therefore, in order to avoid the Cartesian product, generate a large amount of invalid data, and affect the query speed, we must use effective and correct join conditions, such as:
[0098] 1. Establish connection conditions based on primary keys and foreign keys.
[0099] Usually, tables are related through primary keys and foreign keys. Make sure to specify the related columns accurately in the join condition. The primary key is a field in a table that uniquely identifies each row of data and is unique and non-nullable. A foreign key is a reference to the primary key of another table and is used to establish a relationship between tables.
[0100] 2. Avoid vague or incorrect conditions.
[0101] Make the conditions clear and specific, and avoid using conditions that may result in ambiguous matches.
[0102] Therefore, when there is an index in the query statement, it is necessary to check whether the query statement meets the specification requirements. If the query statement meets the specification requirements, step S304 is executed.
[0103] Optionally, if the query statement does not meet the specification requirements, the query statement is modified until the query statement does not meet the specification requirements, and then it is determined whether the query data volume corresponding to the query statement is greater than a preset threshold.
[0104] S304: Determine whether the amount of query data corresponding to the query statement is greater than a preset threshold.
[0105] It should be noted that in order to avoid processing too much data at one time and reduce resource consumption, when the query statement meets the specification requirements, it is necessary to further determine whether the amount of query data corresponding to the query statement is greater than the preset threshold. If the amount of query data corresponding to the query statement is greater than the preset threshold, step S305 is executed. If the amount of query data corresponding to the query statement is less than the preset threshold, step S306 is executed.
[0106] S305: Use the LIMIT function to limit the query data volume corresponding to the query statement to obtain the limited data volume corresponding to the query statement, and determine the limited data volume corresponding to the query statement as the query result.
[0107] It is understandable that when the amount of query data corresponding to a query statement is greater than a preset threshold, the LIMIT function can be used to limit the amount of query data corresponding to the query statement to obtain the limited amount of data corresponding to the query statement, thereby effectively improving the efficiency of SQL execution and avoiding the problem of slow rendering caused by too much query data and a large amount of data being processed by the front end.
[0108] S306: Detect whether there is a multi-table association query in the query statement.
[0109] It is understandable that when the amount of query data corresponding to the query statement is less than the preset threshold, it is also necessary to detect whether there is a multi-table related query in the query statement, because there may be a phenomenon that the data of a report may involve multiple tables. Therefore, if there is a multi-table related query in the query statement, execute step S307.
[0110] Optionally, if there is no multi-table associated query in the query statement, the query data volume corresponding to the query statement is determined as the query result.
[0111] S307: Determine whether the query statement performs an associated query according to the principle of a small table driving a large table.
[0112] It is understandable that if the query statement does not perform an associated query according to the principle of a small table driving a large table, step S308 is executed.
[0113] Optionally, if the query statement performs an associated query according to the principle of a small table driving a large table, the query statement is executed to obtain a query result.
[0114] S308: Optimize the query statement of the report to be tuned to obtain the query result.
[0115] It should be noted that when the query statement does not perform an associated query according to the principle of small tables driving large tables, it is necessary to first obtain data from the smaller data table for matching, and then associate it with the larger data table, so as to reduce the overall amount of calculation and the number of comparisons. This, together with the establishment of indexes and the clear selection of fields, makes the connection operation more efficient. Specifically, first, you need to find the common fields of the two tables to be associated, such as user ID, date or device number, and then ensure that the common field formats in the two tables are consistent. For example, the date format and the ID number format should be the same. Finally, the data of the two tables are merged through the common fields to obtain the associated data, which can use the JOIN operation in the database or merge in the data analysis tool. For example, in the UPM module of the new core application layer report, since the source data is provided by the "TCP_SERVER_PORT" device port table and the "APPLICATION" indicator table, the corresponding relationship between the application name and the device IP exists in the TCP_SERVER_PORT table. We need to take the APPLICATION_ID and SERVER_IP_ADDR fields from TCP_SERVER_PORT to associate with the data in the APPLICATION table. At this time, if you use a larger APPLICATION table to associate with a smaller TCP_SERVER_PORT table, there is a significant difference in execution efficiency, and if you use a smaller table to associate with a larger table, there is a significant difference in execution efficiency. Therefore, using a small table to drive a large table can improve SQL execution efficiency.
[0116] S104: Filter out a target database that meets the data characteristics of the query result from the database, and replace the database used by the query result with the target database in the adjusted report to be optimized to obtain a target report.
[0117] It is understandable that after obtaining the results of the optimized query, the query needs to be linked to the replacement of the appropriate query database to obtain the configured report to be optimized, that is, the target report. Specifically, you can choose a more suitable database engine or database product based on the characteristics, scale and business needs of the data. For example, if the amount of data is extremely large and the query results require high concurrency processing, you can choose a distributed database. If the data structure is relatively simple and the query results have high transaction consistency requirements, you can choose a relational database. This allows the database to better support query operations and provide more stable and efficient services.
[0118] S105. After the replacement is completed, the display logic of the target report is optimized to obtain an optimized report.
[0119] It is understandable that after completing the selection and configuration of the database for the query results, the report display logic needs to be optimized. For example, according to the common needs and usage scenarios of users, the sorting, grouping, aggregation and other operations of data can be optimized to reduce unnecessary calculations and repeated queries, thereby improving the efficiency of users in obtaining information based on the layout and display of the report.
[0120] Optionally, in another embodiment of the present application, a specific implementation of step S105 includes the following steps:
[0121] When the replacement is completed, the display logic of the target report is optimized using preloading to obtain an optimized report.
[0122] It is understandable that replacing the display logic of the target report with the preloaded form can achieve the purpose of optimization, and can automatically preload the SQL of subsequent tabs after loading the tab of the user's query. And when the user clicks the query of the next tab, he only needs to wait for the front-end to render the graphics, and does not need to wait for the SQL to be executed, which can greatly improve the user experience.
[0123] For example, reports will be classified according to different monitoring indicators. For example, the new core application layer monitoring has corresponding indicators for four monitoring tools: BPC, Prometheus, UPM, and DB. Different monitoring tools can be separated by tabs and preloaded (indicators with small data volumes are displayed by default, giving users a "fast loading" feeling. At the same time, after the tab is loaded, SQL preloads for subsequent tabs are automatically performed. When the user clicks on the next tab, they only need to wait for the front-end to render the graphics, rather than waiting for SQL execution, which can greatly improve the user experience. Alternatively, if the report has a lot of content, the content can be displayed separately in the form of tab pages. Multiple pages can be preloaded, with the first page being loaded first, followed by other pages.
[0124] Optionally, after obtaining the tuning report, it is also necessary to detect the query efficiency of the tuning report to determine whether the query efficiency of the tuning report is improved. Therefore, optionally, another embodiment of the present application provides a method for detecting a tuning report, such as Figure 4 As shown, the specific steps include:
[0125] S401, obtain a query instruction.
[0126] Optionally, the operation and maintenance personnel can send a query instruction for the tuning report through the query interface provided by the system, so that the system can obtain the query instruction and perform subsequent related processing. The query instruction refers to an instruction for querying the monitoring system indicators.
[0127] S402: Obtain target data corresponding to the query instruction from the tuning report, and record the response time for obtaining the target data.
[0128] Specifically, you can use the index and query statements in the query command to find the index corresponding to the query command from the tuning report, that is, the target data, and record the response time to obtain the target data to verify whether the query efficiency of the tuning report is improved. The response time includes the time for querying data results and loading the tuning report page.
[0129] S403: Detect whether the response time is less than a preset threshold.
[0130] It can be understood that if the response time is less than the preset threshold, it means that the tuning report is successfully tuned, so step S403 is executed.
[0131] Optionally, if the response time is greater than a preset threshold, it indicates that the tuning report tuning has failed, and the process returns to step S102 to continue tuning.
[0132] S404: Determine whether the report tuning is successful, and provide feedback on the target data.
[0133] It should be noted that in the application embodiment, the execution order of step S102 to step S105 is only one of the optional methods. Since in the application embodiment, step S102 to step S105 are completely independent of each other, the execution order of step S102 to step S105 can also adopt other execution orders, which can be set according to needs.
[0134] The present application provides a method for tuning the performance of a data report, which obtains the report to be tuned, adjusts the data display range of the report to be tuned, optimizes the query statement of the adjusted report to be tuned, obtains the query result, and then screens out the target database that meets the data characteristics of the query result from the database, and replaces the database used for the query result with the target database in the adjusted report to be tuned to obtain the target report, and finally, after the replacement is completed, optimizes the display logic of the target report to obtain the tuned report. Thus, by reducing the amount of query data, optimizing queries, replacing databases, and optimizing display logic for the report to be tuned, the query time of the report to be tuned can be effectively shortened, thereby effectively improving the query efficiency of the report and the efficiency of troubleshooting by operation and maintenance personnel.
[0135] Another embodiment of the present application provides a device for optimizing data report performance, such as Figure 5 As shown, it specifically includes the following units:
[0136] The acquisition unit 501 is used to acquire the report to be optimized.
[0137] The adjustment unit 502 is used to adjust the data display range of the report to be optimized.
[0138] The query optimization unit 503 is used to optimize the query statement of the adjusted report to be optimized to obtain the query result.
[0139] The replacement unit 504 is used to select a target database that meets the data characteristics of the query result from the database, and replace the database used by the query result with the target database in the adjusted report to be optimized to obtain the target report.
[0140] The optimization unit 505 is used to optimize the display logic of the target report after the replacement is completed to obtain an optimized report.
[0141] It should be noted that the specific working process of the above-mentioned units in the embodiment of the present application can refer to steps S101 to S105 in the above-mentioned method embodiment, and will not be repeated here.
[0142] Optionally, in a data report performance tuning device provided in another embodiment of the present application, the adjusting unit 502 includes:
[0143] The time acquisition unit is used to acquire the display time range of the report to be optimized sent by the user.
[0144] The time judgment unit is used to judge whether the setting of the display time range meets the preset requirements.
[0145] The adjustment subunit is used to adjust the display time range if the setting of the display time range does not meet the preset requirements, so as to adjust the data display range of the report to be optimized.
[0146] Optionally, in a data report performance tuning device provided in another embodiment of the present application, the query optimization unit 503 includes:
[0147] The statement acquisition unit is used to acquire multiple query statements of the report to be optimized.
[0148] The first judgment unit is used to judge, for each query statement, whether there is an index on the field used for querying, connecting and sorting in the query statement.
[0149] The checking unit is used to check whether the query statement meets the specification requirements if there is an index on the field used for query, connection and sorting in the query statement.
[0150] The second judgment unit is used to judge whether the amount of query data corresponding to the query statement is greater than a preset threshold if the query statement meets the specification requirements.
[0151] The limiting unit is used to limit the query data volume corresponding to the query statement using the LIMIT function if the query data volume corresponding to the query statement is greater than a preset threshold, obtain the limited data volume corresponding to the query statement, and determine the limited data volume corresponding to the query statement as the query result.
[0152] The relationship detection unit is used to detect whether there is a multi-table association query in the query statement if the query data volume corresponding to the query statement is less than a preset threshold.
[0153] The association judgment unit is used to judge whether the query statement performs the association query according to the principle of small table driving large table if there is a multi-table association query in the query statement.
[0154] The subquery optimization unit is used to optimize the query statement of the report to be tuned to obtain the query result if the query statement does not perform associated query according to the principle of small table driving large table.
[0155] Optionally, in a data report performance tuning device provided in another embodiment of the present application, the optimization unit 505 includes:
[0156] The optimization subunit is used to optimize the display logic of the target report in the form of preloading after the replacement is completed to obtain a tuned report.
[0157] Optionally, a data report performance tuning device provided in another embodiment of the present application further includes:
[0158] The instruction acquisition unit is used to acquire the query instruction.
[0159] The recording unit is used to obtain the target data corresponding to the query instruction from the tuning report and record the response time of obtaining the target data.
[0160] The third detection unit is used to detect whether the response time is less than a preset threshold.
[0161] The feedback unit is used to determine that the tuning report is successfully tuned if the response time is less than a preset threshold, and to feed back the target data.
[0162] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.
[0163] Another embodiment of the present application provides an electronic device, such as Figure 6 As shown, including:
[0164] Memory 601 and processor 602 .
[0165] The memory 601 is used to store programs.
[0166] The processor 602 is used to execute a program. When the program is executed, it is specifically used to implement a method for tuning data report performance as provided in any one of the above embodiments.
[0167] Another embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement a method for tuning data report performance as provided in any of the above embodiments.
[0168] Computer storage media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0169] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0170] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for optimizing data report performance, characterized in that: include: Get the report to be tuned; Adjust the data display range of the report to be optimized; Optimize the query statements of the adjusted report to be optimized and obtain the query results; Filtering out a target database that meets the data characteristics of the query result from the database, and replacing the database used by the query result with the target database in the adjusted report to be optimized, to obtain a target report; When the replacement is completed, the display logic of the target report is optimized to obtain an optimized report.
2. The method according to claim 1, characterized in that The adjusting of the data display range of the report to be optimized includes: Obtaining the display time range of the report to be optimized sent by the user; Determine whether the setting of the display time range meets the preset requirements; If the setting of the display time range does not meet the preset requirements, the display time range is adjusted to adjust the data display range of the report to be optimized.
3. The method according to claim 1, characterized in that The query statement optimization is performed on the adjusted report to be optimized to obtain the query result, including: Obtain multiple query statements of the report to be optimized; For each query statement, determine whether there is an index on the field used for query, connection and sorting by the query statement; If there is an index on the field used by the query statement for query, connection and sorting, check whether the query statement meets the specification requirements; If the query statement meets the specification requirements, determine whether the query data volume corresponding to the query statement is greater than a preset threshold; If the query data volume corresponding to the query statement is greater than a preset threshold, the query data volume corresponding to the query statement is limited by using a LIMIT function to obtain a limited data volume corresponding to the query statement, and the limited data volume corresponding to the query statement is determined as a query result; If the amount of query data corresponding to the query statement is less than a preset threshold, detecting whether there is a multi-table associated query in the query statement; If there is a multi-table associated query in the query statement, determine whether the query statement performs an associated query according to the principle of a small table driving a large table; If the query statement does not perform associated query according to the principle of small table driving large table, the query statement of the report to be optimized is optimized to obtain the query result.
4. The method according to claim 1, characterized in that: After the replacement is completed, the display logic of the target report is optimized to obtain an optimized report, including: When the replacement is completed, the display logic of the target report is optimized in the form of preloading to obtain an optimized report.
5. The method according to claim 1, characterized in that Also includes: Get query instructions; Obtaining target data corresponding to the query instruction from the tuning report, and recording the response time of obtaining the target data; Detecting whether the response time is less than a preset threshold; If the response time is less than the preset threshold, it is determined that the tuning report is successfully tuned, and the target data is fed back.
6. A data report performance tuning device, characterized in that: include: The acquisition unit is used to obtain the report to be tuned; An adjustment unit, used to adjust the data display range of the report to be optimized; The query optimization unit is used to optimize the query statement of the adjusted report to be optimized to obtain the query result; A replacement unit, configured to select a target database that meets the data characteristics of the query result from the database, and replace the database used by the query result with the target database in the adjusted report to be optimized, so as to obtain a target report; The optimization unit is used to optimize the display logic of the target report after the replacement is completed to obtain an optimized report.
7. The device according to claim 6, characterized in that The adjustment unit comprises: A time acquisition unit, used to acquire a display time range of the report to be optimized sent by a user; A time judgment unit, used to judge whether the setting of the display time range meets the preset requirements; The adjusting subunit is used to adjust the display time range if the setting of the display time range does not meet the preset requirements, so as to adjust the data display range of the report to be optimized.
8. The device according to claim 6, characterized in that The query optimization unit comprises: A statement acquisition unit, used to acquire multiple query statements of the report to be optimized; A first judgment unit is used to judge, for each of the query statements, whether there is an index on the field used for querying, connecting and sorting in the query statement; A checking unit, configured to check whether the query statement meets specification requirements if an index exists on the fields used for querying, connecting and sorting by the query statement; A second judgment unit is used to judge whether the amount of query data corresponding to the query statement is greater than a preset threshold if the query statement meets the specification requirements; a limiting unit, configured to limit the query data amount corresponding to the query statement by using a LIMIT function if the query data amount corresponding to the query statement is greater than a preset threshold, to obtain a limited data amount corresponding to the query statement, and determine the limited data amount corresponding to the query statement as a query result; A relationship detection unit, configured to detect whether there is a multi-table association query in the query statement if the amount of query data corresponding to the query statement is less than a preset threshold; An association judgment unit, used for judging whether the query statement performs an association query according to the principle of a small table driving a large table if there is a multi-table association query in the query statement; The sub-query optimization unit is used to optimize the query statement of the report to be optimized to obtain the query result if the query statement does not perform the associated query according to the principle of the small table driving the large table.
9. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store programs; The processor is used to execute the program, and when the program is executed, it is specifically used to implement a data report performance tuning method as described in any one of claims 1 to 5.
10. A computer storage medium, characterized in that: Used to store a computer program, which, when executed, is used to implement a method for tuning data report performance as described in any one of claims 1 to 5.