Visual database analysis method and system

By configured MySQL inquiries in the database analysis system and use the beetle group optimization algorithm to find and position slow query in time, improve the query efficiency. At the same time, through statistics and visual and visual CRUD operations, I will intuitively understand the database operation conditions and trends, solve the problems that slowly query in the existing technology cannot be discovered and located in time, and the database operation is difficult to understand intuitively. Improve.

CN119357229APending Publication Date: 2025-01-24SHENZHEN LAIBANG IND CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411738067.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The existing visual database analysis methods have slow queries that cannot be discovered and located in a timely manner, and cannot accurately analyze the specific execution of slow queries, resulting in system performance degradation, increasing maintenance costs and difficulty, and affecting user experience. At the same time, database analysis tools lack visual display of the number of CRUD operations, making it difficult to intuitively understand database operation situations and trends.

Method used

Using the slow query optimization method, configure the MySQL slow query log on the back-end server, use the beetle swarm optimization algorithm to calculate the location and moving speed of the beetles, adjust the inertia weight, and search and analyze the factors leading to slow queries through the slow query log data to improve query efficiency. At the same time, all CRUD operation requests are counted, the type and number of operations are recorded, updated in real time and provided to the front end, the objective function is calculated through singular value decomposition and principal component compression, the operation of the database by the back-end server is evaluated, and the back-end is evaluated based on the analysis results. The server adjusts.

Benefits of technology

Through the slow query optimization method, slow queries can be discovered and located in a timely manner, improving query efficiency, reducing system maintenance costs and difficulties, and improving user experience. Through the visual display of the number of CRUD operations, you can intuitively understand the database operation status and trends, quickly discover abnormal operations and key areas of frequent operations, and improve database management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357229A_ABST
    Figure CN119357229A_ABST
Patent Text Reader

Abstract

The invention discloses a visual database analysis method and system. The method comprises the steps of shunting statistics, slow query optimization, back-end server establishment, CRUD operation visual display and development of a front-end display interface. The invention belongs to the technical field of database analysis, and particularly relates to a visual database analysis method and system.According to the scheme, slow query optimization is adopted, a MySQL slow query log is configured on a back-end server, the position and the moving speed of beetles are calculated, the inertia weight is adjusted, and factors causing slow query are searched and analyzed by means of slow query log data; the query efficiency is improved; the method comprises the following steps of: counting operation requests of all CRUDs, recording operation types and times, updating and providing the operation requests to a front end in real time, decomposing and sorting operation data, performing singular value decomposition, performing principal component compression and calculating a target function to evaluate the operation condition of a rear-end server on a database, including overall efficiency and resource utilization; and adjusting the back-end server according to the analysis of the target function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of database analysis, and in particular relates to a visual database analysis method and system. Background Art

[0002] The visual database analysis method is a technical architecture based on Flask backend and Vue.js frontend, which combines Flask's powerful backend processing capabilities with Vue.js's excellent frontend interactive performance. In this architecture, Flask is responsible for processing data logic, business processes, database and other backend resource interactions, while Vue.js focuses on building user interfaces, creating intuitive, friendly and highly interactive frontend interfaces with efficient componentization and good user experience characteristics. By adopting intuitive display methods and in-depth statistical analysis, it helps users better understand the situation of the database, discover potential problems in a timely manner, and take corresponding optimization measures. However, the existing visual database analysis methods have the problem that slow queries cannot be discovered and located in a timely manner, and the specific execution of slow queries cannot be accurately analyzed, resulting in a decrease in the overall performance of the system, increasing the maintenance cost and difficulty of the system, and affecting the user experience. There are technical problems that most database analysis tools only provide basic database operation functions and lack a visual display of the number of CRUD operations, which makes it difficult to intuitively understand the specific situation and trend of database operations, and is not conducive to quickly discovering abnormal operations and frequent operations in key areas. Summary of the invention

[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a visual database analysis method and system, which aims at the technical problems that slow queries cannot be discovered and located in time, the specific execution of slow queries cannot be accurately analyzed, resulting in a decrease in the overall performance of the system, an increase in the maintenance cost and difficulty of the system, and an impact on the user experience. Slow query optimization is adopted, MySQL slow query log is configured on the back-end server, the beetle swarm optimization algorithm is used, the beetle position and movement speed are calculated, the inertia weight is adjusted, and the factors causing slow queries are searched and analyzed with the help of slow query log data to improve the query efficiency; in view of the technical problems that most existing database analysis tools only provide basic database operation functions, lack a visual display of the number of CRUD operations, resulting in difficulty in intuitively understanding the specific situation and trend of database operations, and are not conducive to quickly discovering abnormal operations and key areas of frequent operations, all CRUD operation requests are counted, the operation type and number are recorded and updated in real time to the front end, the operation data is decomposed and sorted, and principal component compression is performed through singular value decomposition, and the objective function is calculated to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and the back-end server is adjusted according to the analysis of the objective function.

[0004] The technical solution adopted by the present invention is as follows: The present invention provides a visual database analysis method, which comprises the following steps:

[0005] Step S1: traffic statistics, specifically obtaining the flow and distribution of data;

[0006] Step S2: Slow query optimization, specifically configuring MySQL slow query logs on the backend server, using the beetle swarm optimization algorithm, calculating the beetle position and movement speed, adjusting the inertia weight, and using the slow query log data to search and analyze the factors that cause slow queries to improve query efficiency;

[0007] Step S3: Backend server construction, specifically using the Flask framework to build the backend server, and establishing a connection with the MySQL database through the Python MySQL connector. The backend server is responsible for receiving requests sent by the front end, performing database operations, and returning the results to the front end;

[0008] Step S4: Visual display of CRUD operations, specifically counting all CRUD operation requests, recording the operation type and number and updating them in real time to the front end, decomposing and sorting the operation data, performing principal component compression through singular value decomposition, and calculating the objective function to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and adjusting the back-end server according to the analysis of the objective function;

[0009] Step S5: Develop a front-end display interface, specifically using the Vue.js framework to develop a front-end display interface, including charts and tables, for intuitively displaying the number of CRUD operations and slow query analysis results, so as to better understand the performance of the database.

[0010] Furthermore, in step S1, the traffic distribution statistics include the following steps:

[0011] Step S11: Determine the diversion dimensions that need to be counted, including dividing according to different data source channels, different time periods and different business types;

[0012] Step S12: Setting monitoring points at each node through which the data flows, and recording the passing of relevant data;

[0013] Step S13: Use the database query statement to classify, summarize and calculate the data, count the data volume and traffic proportion information under each dimension, process and analyze the collected data to clearly present the specific situation of the diversion, ensure the accuracy and completeness of data collection, so as to obtain reliable diversion statistical results.

[0014] Furthermore, in step S2, the slow query optimization includes the following steps:

[0015] Step S21: configure the slow query log, configure the slow query log function of MySQL on the backend server, determine the threshold time of slow query, MySQL automatically records the query records that meet the slow query conditions into the log file, and the backend server periodically reads the slow query log file;

[0016] Step S22: Using the beetle swarm optimization algorithm, the position of the beetle in the search space is calculated to find possible optimization directions and potential improvement points. The formula used is as follows:

[0017] ;

[0018] In the formula, represents the position of the i-th beetle in the search space when the number of iterations is k+1, represents the position of the i-th beetle in the search space when the number of iterations is k, represents the position movement range of the i-th beetle when the number of iterations is k, represents the moving speed of the ith beetle when the number of iterations is k, and μ is used to control the influence weight on the beetle position update;

[0019] Step S23: Calculate the moving speed of the beetle. Different speeds are used to balance the global extensive exploration and local fine development during the algorithm operation, so as to find potential better solutions in a larger range and conduct in-depth exploration in the discovered areas. The formula used is as follows:

[0020] ;

[0021] In the formula, represents the moving speed of the i-th beetle when the number of iterations is k+1, represents the speed update factor of the i-th beetle, represents the speed update factor of the entire beetle group, w represents the improved inertia weight, and represents a random weight in the range [0, 1], represents the optimal position of the i-th beetle when the number of iterations is k, represents the optimal position of the entire group when the number of iterations is k, Indicates the current position of the entire group when the number of iterations is k;

[0022] Step S24: Improve the inertia weight. As the iteration proceeds, the inertia weight gradually changes from the maximum value to the minimum value. This ensures that a larger inertia is maintained in the early stage of the algorithm, which helps to search in a larger range. In the later stage, the inertia weight is reduced, making the algorithm more inclined to fine search, improving the convergence speed and accuracy of the algorithm. The formula used is as follows:

[0023] ;

[0024] Where w represents the improved inertia weight, represents the maximum value of the inertia weight, represents the minimum value of the inertia weight, and K represents the maximum number of iterations;

[0025] Step S25: Evolutionary search. At the beginning of evolution, the algorithm's search range is larger. After detecting the optimal solution, the beetle will slow down and enter local search. The formula used is as follows:

[0026] ;

[0027] In the formula, represents the position movement range of the i-th beetle when the number of iterations is k, δ represents the step size, sign represents the sign function, represents the random optimal position of the entire population when the number of iterations is k, Represents the current random position of the entire population when the number of iterations is k;

[0028] Step S26: Adjust and optimize, search and analyze the factors that cause slow queries according to the beetle swarm optimization algorithm, analyze and improve the factors that cause slow queries in a targeted manner, and improve system performance and user experience.

[0029] Furthermore, in step S3, the backend server is built, specifically using the Flask framework to build the backend server, and a connection is established with the MySQL database through the Python MySQL connector. The backend server is responsible for receiving requests sent by the front end, executing database operations, and returning the results to the front end.

[0030] Furthermore, in step S4, the CRUD operation is visually displayed, including the following steps:

[0031] Step S41: Counting operation requests. The backend server counts all CRUD operation requests to the MySQL database, records the type and number of each operation, updates the statistical information in real time, and provides it to the front end for display.

[0032] The operation types include add, delete, modify and check;

[0033] Step S42: Decomposing the operation data is used to present the internal structure and relationship of the operation data in a clearer and more organized manner, simplify the complexity of the operation data, organize the operation data, arrange the number of different types of operations and operation time according to rules to form elements of the matrix, and decompose the matrix into different components through singular values. The formula used is as follows:

[0034] ;

[0035] Where H represents the output matrix, and represents the matrix generated in the singular value decomposition process, T represents the transpose of the matrix, represents the first part after decomposing the matrix H, Represents the second part after decomposing the matrix H;

[0036] Step S43: Perform principal component compression operation on the output matrix to further simplify and refine the operation data. The formula used is as follows:

[0037] ;

[0038] In the formula, P represents the principal component compression operation, diag represents the diagonal matrix related to the principal component compression, which contains the weight information of the data on the principal component. represents the singular value decomposition matrix after principal component compression operation;

[0039] Step S44: Calculate the objective function to evaluate the operation of the backend server on the database, including overall efficiency and resource utilization. The formula used is as follows:

[0040] ;

[0041] In the formula, T1 represents the objective function, Represents the output weight, which is used to adjust the importance of different factors in the objective function;

[0042] Step S45: Analyze according to the objective function, adjust the backend server according to the analysis results, and feed back to the visualization to show the changes before and after the adjustment, so that users can better understand and monitor the improvement of the system.

[0043] Furthermore, in step S5, the development of the front-end display interface includes the following steps:

[0044] Step S51: Install the Vue.js framework, create the basic structure and files of the Vue.js project, design the layout of the front-end interface, divide the area for displaying charts and tables, and display a chart of the number of CRUD operations;

[0045] Step S52: construct a data table for displaying the slow query analysis results, realize the interaction function between the user and the front-end interface, beautify the interface style, improve the user experience, and ensure that the functions are normal and stable.

[0046] The present invention provides a visual database analysis system, which includes a traffic distribution statistics module, a slow query optimization module, a back-end server construction module, a CRUD operation visualization display module and a front-end display interface development module;

[0047] The traffic statistics module is specifically used to obtain the flow and distribution of data;

[0048] The slow query optimization module specifically configures MySQL slow query logs on the backend server, uses the beetle swarm optimization algorithm to calculate the beetle position and movement speed, adjusts the inertia weight, and uses the slow query log data to search and analyze the factors that cause slow queries to improve query efficiency;

[0049] The back-end server building module specifically uses the Flask framework to build the back-end server, establishes a connection with the MySQL database through the Python MySQL connector, and the back-end server is responsible for receiving requests sent by the front-end, performing database operations, and returning the results to the front-end;

[0050] The CRUD operation visualization display module specifically counts all CRUD operation requests, records the operation type and number, and updates and provides them to the front end in real time, decomposes and organizes the operation data, performs principal component compression through singular value decomposition, calculates the objective function to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and adjusts the back-end server according to the analysis of the objective function;

[0051] The front-end display interface module is developed by using the Vue.js framework, including charts and tables, which are used to intuitively display the number of CRUD operations and slow query analysis results, so as to better understand the performance of the database.

[0052] The beneficial results achieved by the present invention using the above scheme are as follows:

[0053] (1) To address the technical issues that slow queries cannot be discovered and located in a timely manner, and the specific execution status of slow queries cannot be accurately analyzed, resulting in a decline in the overall system performance, increased system maintenance costs and difficulty, and a negative impact on user experience, slow query optimization is adopted. MySQL slow query logs are configured on the backend server, and the beetle swarm optimization algorithm is used to calculate the beetle position and movement speed, adjust the inertia weight, and use the slow query log data to search and analyze the factors that cause slow queries, thereby improving query efficiency;

[0054] (2) Most existing database analysis tools only provide basic database operation functions and lack a visual display of the number of CRUD operations, which makes it difficult to intuitively understand the specific situation and trend of database operations and is not conducive to quickly discovering technical problems in key areas of abnormal operations and frequent operations. This paper adopts the method of counting all CRUD operation requests, recording the operation type and number, and updating them in real time to the front end. The operation data is decomposed and sorted, and principal component compression is performed through singular value decomposition. The objective function is calculated to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and the back-end server is adjusted according to the analysis of the objective function. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A schematic diagram of a flow chart of a visual database analysis method provided by the present invention;

[0056] Figure 2 A schematic diagram of a visual database analysis system provided by the present invention;

[0057] Figure 3 is a schematic flow chart of step S2;

[0058] Figure 4 It is a schematic diagram of the process of step S4.

[0059] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION

[0060] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0061] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.

[0062] Example 1, see Figure 1 The present invention provides a visual database analysis method, which comprises the following steps:

[0063] Step S1: traffic statistics, specifically obtaining the flow and distribution of data;

[0064] Step S2: Slow query optimization, specifically configuring MySQL slow query logs on the backend server, using the beetle swarm optimization algorithm, calculating the beetle position and movement speed, adjusting the inertia weight, and using the slow query log data to search and analyze the factors that cause slow queries to improve query efficiency;

[0065] Step S3: Backend server construction, specifically using the Flask framework to build the backend server, and establishing a connection with the MySQL database through the Python MySQL connector. The backend server is responsible for receiving requests sent by the front end, performing database operations, and returning the results to the front end;

[0066] Step S4: Visual display of CRUD operations, specifically counting all CRUD operation requests, recording the operation type and number and updating them in real time to the front end, decomposing and sorting the operation data, performing principal component compression through singular value decomposition, and calculating the objective function to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and adjusting the back-end server according to the analysis of the objective function;

[0067] Step S5: Develop a front-end display interface, specifically using the Vue.js framework to develop a front-end display interface, including charts and tables, for intuitively displaying the number of CRUD operations and slow query analysis results, so as to better understand the performance of the database.

[0068] Example 2, see Figure 1 This embodiment is based on the above embodiment. In step S1, the traffic distribution statistics include the following steps:

[0069] Step S11: Determine the diversion dimensions that need to be counted, including dividing according to different data source channels, different time periods and different business types;

[0070] Step S12: Setting monitoring points at each node through which the data flows, and recording the passing of relevant data;

[0071] Step S13: Use the database query statement to classify, summarize and calculate the relevant data, count the data volume and traffic proportion information under each dimension, process and analyze the collected data to clearly present the specific situation of the diversion, ensure the accuracy and completeness of data collection, so as to obtain reliable diversion statistical results.

[0072] Example 3, see Figure 1 and Figure 3 This embodiment is based on the above embodiment. In step S2, the slow query optimization includes the following steps:

[0073] Step S21: configure the slow query log, configure the slow query log function of MySQL on the backend server, determine the threshold time of slow query, MySQL automatically records the query records that meet the slow query conditions into the log file, and the backend server periodically reads the slow query log file;

[0074] Step S22: Using the beetle swarm optimization algorithm, the position of the beetle in the search space is calculated to find possible optimization directions and potential improvement points. The formula used is as follows:

[0075] ;

[0076] In the formula, represents the position of the i-th beetle in the search space when the number of iterations is k+1, represents the position of the i-th beetle in the search space when the number of iterations is k, represents the position movement range of the i-th beetle when the number of iterations is k, represents the moving speed of the ith beetle when the number of iterations is k, and μ is used to control the influence weight on the beetle position update;

[0077] Step S23: Calculate the moving speed of the beetle. Different speeds are used to balance the global extensive exploration and local fine development during the algorithm operation, so as to find potential better solutions in a larger range and conduct in-depth exploration in the discovered areas. The formula used is as follows:

[0078] ;

[0079] In the formula, represents the moving speed of the i-th beetle when the number of iterations is k+1, represents the speed update factor of the i-th beetle, represents the speed update factor of the entire beetle group, w represents the improved inertia weight, and represents a random weight in the range [0, 1], represents the optimal position of the i-th beetle when the number of iterations is k, represents the optimal position of the entire group when the number of iterations is k, Indicates the current position of the entire group when the number of iterations is k;

[0080] Step S24: Improve the inertia weight. As the iteration proceeds, the inertia weight gradually changes from the maximum value to the minimum value. This ensures that a larger inertia is maintained in the early stage of the algorithm, which helps to search in a larger range. In the later stage, the inertia weight is reduced, making the algorithm more inclined to fine search, improving the convergence speed and accuracy of the algorithm. The formula used is as follows:

[0081] ;

[0082] Where w represents the improved inertia weight, represents the maximum value of the inertia weight, represents the minimum value of the inertia weight, and K represents the maximum number of iterations;

[0083] Step S25: Evolutionary search. At the beginning of evolution, the algorithm's search range is larger. After detecting the optimal solution, the beetle will slow down and enter local search. The formula used is as follows:

[0084] ;

[0085] In the formula, represents the position movement range of the i-th beetle when the number of iterations is k, δ represents the step size, sign represents the sign function, represents the random optimal position of the entire population when the number of iterations is k, Represents the current random position of the entire population when the number of iterations is k;

[0086] Step S26: Adjust and optimize, search and analyze the factors that cause slow queries according to the beetle swarm optimization algorithm, analyze and improve the factors that cause slow queries in a targeted manner, and improve system performance and user experience.

[0087] By performing the above operations, slow query optimization is adopted, MySQL slow query log is configured on the back-end server, the beetle swarm optimization algorithm is used, the beetle position and movement speed are calculated, the inertia weight is adjusted, and the factors causing slow queries are searched and analyzed with the help of slow query log data to improve query efficiency. This solves the technical problems that slow queries cannot be discovered and located in a timely manner, the specific execution of slow queries cannot be accurately analyzed, resulting in a decline in the overall performance of the system, increased system maintenance costs and difficulty, and affecting user experience.

[0088] Example 4, see Figure 1 This embodiment is based on the above embodiment. In step S3, the back-end server is built, specifically using the Flask framework to build the back-end server, and establishing a connection with the MySQL database through the Python MySQL connector. The back-end server is responsible for receiving requests sent by the front-end, executing database operations, and returning the results to the front-end.

[0089] Example 5, see Figure 1 and Figure 4 This embodiment is based on the above embodiment. In step S4, the CRUD operation is visualized, including the following steps:

[0090] Step S41: Counting operation data. The backend server counts all CRUD operation requests to the MySQL database, records the type and number of each operation, updates the statistical information in real time, and provides it to the front end for display.

[0091] The operation types include add, delete, modify and check;

[0092] Step S42: Decomposing the operation data is used to present the internal structure and relationship of the operation data in a clearer and more organized manner, simplify the complexity of the operation data, organize the operation data, arrange the number of different types of operations and operation time according to rules to form elements of the matrix, and decompose the matrix into different components through singular values. The formula used is as follows:

[0093] ;

[0094] Where H represents the output matrix, and represents the matrix generated in the singular value decomposition process, T represents the transpose of the matrix, represents the first part after decomposing the matrix H, Represents the second part after decomposing the matrix H;

[0095] Step S43: Perform principal component compression operation on the output matrix to further simplify and refine the operation data. The formula used is as follows:

[0096] ;

[0097] In the formula, P represents the principal component compression operation, diag represents the diagonal matrix related to the principal component compression, which contains the weight information of the data on the principal component. represents the singular value decomposition matrix after principal component compression operation;

[0098] Step S44: Calculate the objective function to evaluate the operation of the backend server on the database, including overall efficiency and resource utilization. The formula used is as follows:

[0099] ;

[0100] In the formula, T1 represents the objective function, Represents the output weight, which is used to adjust the importance of different factors in the objective function;

[0101] Step S45: Analyze according to the objective function, adjust the backend server according to the analysis results, and feed back to the visualization to show the changes before and after the adjustment, so that users can better understand and monitor the improvement of the system.

[0102] By executing the above operations, all CRUD operation requests are counted, the operation type and number are recorded and updated in real time to the front end, the operation data is decomposed and sorted, and principal component compression is performed through singular value decomposition. The objective function is calculated to evaluate the operation of the back-end server on the database, including the overall efficiency and resource utilization. The back-end server is adjusted according to the analysis of the objective function, which solves the technical problem that most database analysis tools only provide basic database operation functions and lack a visual display of the number of CRUD operations, making it difficult to intuitively understand the specific situation and trend of database operations, and is not conducive to quickly discovering abnormal operations and key areas of frequent operations.

[0103] Example 6, see Figure 1 This embodiment is based on the above embodiment. In step S5, the development of the front-end display interface includes the following steps:

[0104] Step S51: Install the Vue.js framework, create the basic structure and files of the Vue.js project, design the layout of the front-end interface, divide the area for displaying charts and tables, and display a chart of the number of CRUD operations;

[0105] Step S52: construct a data table for displaying the slow query analysis results, realize the interaction function between the user and the front-end interface, beautify the interface style, improve the user experience, and ensure that the functions are normal and stable.

[0106] Embodiment 7, see Figure 2 , this embodiment is based on the above embodiment, and a visual database analysis system provided by the present invention includes a traffic distribution statistics module, a slow query optimization module, a back-end server construction module, a CRUD operation visual display module and a front-end display interface development module;

[0107] The traffic statistics module is specifically used to obtain the flow and distribution of data;

[0108] The slow query optimization module specifically configures MySQL slow query logs on the backend server, uses the beetle swarm optimization algorithm to calculate the beetle position and movement speed, adjusts the inertia weight, and uses the slow query log data to search and analyze the factors that cause slow queries to improve query efficiency;

[0109] The back-end server building module specifically uses the Flask framework to build the back-end server, establishes a connection with the MySQL database through the Python MySQL connector, and the back-end server is responsible for receiving requests sent by the front-end, performing database operations, and returning the results to the front-end;

[0110] The CRUD operation visualization display module specifically counts all CRUD operation requests, records the operation type and number, and updates and provides them to the front end in real time, decomposes and organizes the operation data, performs principal component compression through singular value decomposition, calculates the objective function to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and adjusts the back-end server according to the analysis of the objective function;

[0111] The front-end display interface module is developed by using the Vue.js framework, including charts and tables, which are used to intuitively display the number of CRUD operations and slow query analysis results, so as to better understand the performance of the database.

[0112] It should be noted that, in this article, relational terms such as first and second, etc. are only used 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 "include", "comprise" 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.

[0113] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.

[0114] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.

Claims

1. A visual database analysis method, characterized in that: The method comprises the following steps: Step S1: traffic statistics, obtaining data flow and distribution; Step S2: Slow query optimization, specifically configuring MySQL slow query logs on the backend server, using the beetle swarm optimization algorithm, calculating the beetle position and movement speed, adjusting the inertia weight, and searching and analyzing the factors that cause slow queries with the help of slow query log data; Step S3: Backend server construction, specifically using the Flask framework to build the backend server, and establishing a connection with the MySQL database through the Python MySQL connector. The backend server is responsible for receiving requests sent by the front end, performing database operations, and returning the results to the front end; Step S4: Visual display of CRUD operations, specifically counting all CRUD operation requests, recording the operation type and number and updating them in real time to the front end, decomposing and sorting the operation data, performing principal component compression through singular value decomposition, and calculating the objective function to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and adjusting the back-end server according to the analysis of the objective function; Step S5: Develop a front-end display interface, specifically using the Vue.js framework to develop the front-end display interface, including charts and tables, for intuitively displaying the number of CRUD operations and slow query analysis results.

2. A visual database analysis method according to claim 1, characterized in that: In step S2, the slow query optimization includes the following steps: Step S21: configure the slow query log, configure the slow query log function of MySQL on the backend server, determine the threshold time of slow query, MySQL automatically records the query records that meet the slow query conditions into the log file, and the backend server periodically reads the slow query log file; Step S22: Using the beetle swarm optimization algorithm, calculate the position of the beetle in the search space. The formula used is as follows: ; In the formula, represents the position of the i-th beetle in the search space when the number of iterations is k+1, represents the position of the i-th beetle in the search space when the number of iterations is k, represents the position movement range of the i-th beetle when the number of iterations is k, represents the moving speed of the ith beetle when the number of iterations is k, and μ is used to control the influence weight on the beetle position update; Step S23: Calculate the moving speed of the beetle using the following formula: ; In the formula, represents the moving speed of the i-th beetle when the number of iterations is k+1, represents the speed update factor of the i-th beetle, represents the speed update factor of the entire beetle group, w represents the improved inertia weight, and represents a random weight in the range [0, 1], represents the optimal position of the i-th beetle when the number of iterations is k, represents the optimal position of the entire group when the number of iterations is k, Indicates the current position of the entire group when the number of iterations is k; Step S24: Improve the inertia weight, the formula used is as follows: ; Where w represents the improved inertia weight, represents the maximum value of the inertia weight, represents the minimum value of the inertia weight, and K represents the maximum number of iterations; Step S25: Evolutionary search. At the beginning of evolution, the algorithm's search range is larger. After detecting the optimal solution, the beetle will slow down and enter local search. The formula used is as follows: ; In the formula, represents the position movement range of the i-th beetle when the number of iterations is k, δ represents the step size, sign represents the sign function, represents the random optimal position of the entire population when the number of iterations is k, Represents the current random position of the entire population when the number of iterations is k; Step S26: Adjust and optimize, search and analyze the factors that cause slow queries according to the beetle swarm optimization algorithm, and analyze and improve the factors that cause slow queries in a targeted manner.

3. A visual database analysis method according to claim 1, characterized in that: In step S4, the CRUD operation is visually displayed, including the following steps: Step S41: The backend server counts all CRUD operation requests to the MySQL database, records the type and number of each operation, updates the statistical information in real time, and provides it to the front end for display; The operation types include add, delete, modify and check; Step S42: Decomposing the operation data is used to simplify the complexity of the operation data. The operation data is sorted, and the number of operations and operation time of different types are arranged according to rules to form elements of the matrix. The matrix is ​​decomposed into different components through singular values. The formula used is as follows: ; Where H represents the output matrix, and represents the matrix generated in the singular value decomposition process, T represents the transpose of the matrix, represents the first part after decomposing the matrix H, Represents the second part after decomposing the matrix H; Step S43: Perform principal component compression operation on the output matrix, and the formula used is as follows: ; In the formula, P represents the principal component compression operation, diag represents the diagonal matrix related to the principal component compression, which contains the weight information of the data on the principal component. represents the singular value decomposition matrix after principal component compression operation; Step S44: Calculate the objective function to evaluate the operation of the backend server on the database, including overall efficiency and resource utilization. The formula used is as follows: ; In the formula, T1 represents the objective function, Represents the output weight, which is used to adjust the importance of different factors in the objective function; Step S45: Analyze according to the objective function, adjust the backend server according to the analysis results, and feed back to the visualization.

4. A visual database analysis method according to claim 1, characterized in that: In step S1, the traffic distribution statistics include the following steps: Step S11: Determine the diversion dimensions that need to be counted, including dividing according to different data source channels, different time periods and different business types; Step S12: Setting monitoring points at each node through which the data flows, and recording the passing of relevant data; Step S13: Use the query statement of the database to classify, summarize and calculate the data, count the data volume and traffic proportion information under each dimension, process and analyze the collected data, and present the specific situation of the diversion in order to obtain reliable diversion statistical results.

5. A visual database analysis method according to claim 1, characterized in that: In step S3, the backend server is built, specifically using the Flask framework to build the backend server, and establishing a connection with the MySQL database through Python's MySQL connector. The backend server is responsible for receiving requests sent by the front end, performing corresponding database operations, and returning the results to the front end.

6. A visual database analysis method according to claim 1, characterized in that: In step S5, the development of the front-end display interface includes the following steps: Step S51: Install the Vue.js framework, design the layout of the front-end interface, divide the area for displaying charts and tables, and display a chart of the number of CRUD operations; Step S52: construct a data table for displaying the slow query analysis results, realize the interaction function between the user and the front-end interface, and beautify the style of the interface.

7. A visual database analysis system, used to implement a visual database analysis method as claimed in any one of claims 1 to 6, characterized in that: It includes diversion statistics module, slow query optimization module, back-end server construction module, CRUD operation visualization display module and front-end display interface development module.

8. A visual database analysis system according to claim 7, characterized in that: The traffic distribution statistics module is specifically used to understand the flow and distribution of data; The slow query optimization module specifically configures MySQL slow query logs on the backend server, uses the beetle swarm optimization algorithm to calculate the beetle position and movement speed, adjusts the inertia weight, and uses the slow query log data to search and analyze the factors that cause slow queries; The back-end server building module specifically uses the Flask framework to build the back-end server, establishes a connection with the MySQL database through the Python MySQL connector, and the back-end server is responsible for receiving requests sent by the front-end, performing database operations, and returning the results to the front-end; The CRUD operation visualization display module specifically counts all CRUD operation requests, records the operation type and number, and updates and provides them to the front end in real time, decomposes and organizes the operation data, performs principal component compression through singular value decomposition, calculates the objective function to evaluate the operation of the back-end server on the database, including overall efficiency and resource utilization, and adjusts the back-end server according to the analysis of the objective function; The front-end display interface module is developed by using the Vue.js framework, including charts and tables, which are used to intuitively display the number of CRUD operations and slow query analysis results, so as to better understand the performance of the database.

Citation Information

Cited By

  • Electronic medical record tamper-proofing and credible interaction method based on block chain

    CN120564940A

  • Blockchain-based electronic medical record tamper-proof and trusted interaction method

    CN120564940B