Self-adaptive query optimizer of time sequence database
By introducing an adaptive query optimizer into the timing database, dynamically adjusting query plans and resource management, and using machine learning-driven continuous optimization, the problems of instability in query performance and waste of resources in the existing technology are solved, and the performance of the database is significantly improved and user experience, suitable for a variety of complex query scenarios.
Patent Information
- Application Number
- CN202411301578.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The lack of adaptive query optimizers for existing timing databases leads to unstable query performance, wasted resources and poor user experience, especially in the face of dynamic and complex query modes, which increases maintenance costs and complexity.
Designed an adaptive query optimizer for timing databases, including query mode analysis and classification module, adaptive optimization strategy generation module, machine learning and prediction module, real-time optimization and execution module, and user feedback and custom optimization module, through dynamic Adjusting query planning, resource management and leveraging machine learning-driven continuous optimization improves the performance stability and query efficiency of the database.
Effectively improve the performance stability and query efficiency of timing databases, reduce maintenance costs, significantly improve the system's response speed and real-time and reliability of data queries. It is suitable for the Internet of Things, financial analysis, industrial Internet of Things, smart cities and Environmental monitoring and other fields.
Smart Images

Figure CN119179708A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database data query, and in particular to an adaptive query optimizer for a time series database. Background Art
[0002] Time Series Database (TSDB) is a database designed specifically for storing and managing time series data. With the rapid development of IoT devices, monitoring systems, financial markets, industrial sensors and other fields, the volume and complexity of time series data are increasing, which puts higher requirements on the performance of time series databases.
[0003] Existing time series database optimization methods: Fixed indexes and data structures: Most time series databases use fixed index structures, such as B-trees, LSM trees, or hash indexes. These structures are effective in processing specific types of queries, but may perform poorly in the face of diverse query scenarios.
[0004] Manual tuning: Currently, database administrators (DBAs) need to manually analyze query loads and adjust database configuration parameters, index structures, storage engines, etc. to optimize query performance. This approach is inefficient and relies on the experience of experts, and cannot cope with dynamically changing query patterns.
[0005] Static query optimizer: Existing time series databases usually use static query optimizers to generate query plans based on predefined rules and cost models. This optimizer works well when facing stable and known query patterns, but may not be able to generate the best query plan in a dynamic and changing query environment.
[0006] Caching mechanism: Some time series databases have introduced a caching mechanism to store recently accessed data and indexes in memory to speed up queries. However, this approach has limited effect on queries that need to access historical data or global data.
[0007] The impact and inconvenience of not having an adaptive query optimizer Query performance fluctuations: Due to the lack of adaptive capabilities for dynamic query patterns, time series databases may experience unstable performance when facing different types of queries. For example, when facing new query patterns or sudden query loads, the database response time may increase significantly, resulting in a poor user experience.
[0008] High maintenance costs: Without an adaptive query optimizer, database administrators must frequently perform manual tuning to cope with ever-changing query patterns. This not only increases maintenance costs, but also requires a lot of human resources and time.
[0009] Inefficient data utilization: When processing complex queries, existing static query optimizers may not be able to fully utilize all data structures and indexes in the database, resulting in inefficient query. For example, when users perform large-scale time interval queries, traditional optimizers may not be able to find the best data access path, resulting in slow query speed.
[0010] Resource waste: As existing optimizers cannot dynamically adjust resource allocation according to actual query patterns, this may lead to resource waste. For example, under low load conditions, the database still runs according to the high load configuration, wasting computing and storage resources; under high load conditions, insufficient resources may occur due to improper optimization.
[0011] Poor user experience: For end users, response speed is an important performance indicator of time series databases. If the query response time is unstable, especially if there is a query delay at a critical moment (such as when an anomaly is found in the monitoring system), it will seriously affect the user experience and system reliability.
[0012] Typical scenario description IoT monitoring system: In IoT monitoring systems, time series data from devices is constantly pouring in. Administrators may frequently query recent data to monitor system status, or they may analyze historical data. If the query optimizer cannot adaptively adjust the strategy, it may access too much irrelevant historical data when querying recent data, or cause long delays when analyzing historical data due to improper optimization.
[0013] Financial market analysis: In the financial field, time series data is very important, such as stock prices, trading volumes, etc. Financial analysts may perform complex queries and analyses on data from different time periods. If the query optimizer cannot dynamically adjust strategies based on different queries, it may lead to analysis delays and missed market opportunities.
[0014] In general, time series databases without adaptive query optimizers perform poorly when faced with complex and dynamic query patterns, which may lead to performance fluctuations, resource waste, and poor user experience. This situation not only increases the complexity of system maintenance, but also affects the efficient use of time series data. In modern application scenarios, especially in the Internet of Things, finance, and monitoring systems, the lack of adaptive query optimizers will bring significant inconvenience and potential risks. Summary of the invention
[0015] In response to the above technical problems, the present invention provides an adaptive query optimizer for a time series database.
[0016] The present invention is implemented by adopting the following technical scheme: an adaptive query optimizer for a time series database, comprising a query pattern analysis and classification module, an adaptive optimization strategy generation module, a machine learning and prediction module, a real-time optimization and execution module, and a user feedback and custom optimization module, wherein: Query pattern analysis and classification module, used to analyze and classify query patterns to identify common query patterns and possible optimization points; Adaptive optimization strategy generation module, used to automatically generate and adjust query optimization strategies based on query pattern analysis results; Machine learning and prediction modules are used to predict future query pattern changes and optimize in advance; Real-time optimization and execution module, used to apply the generated optimization strategy to the database in real time and monitor its effect; User feedback and custom optimization module, used to provide feedback on optimization results and provide custom optimization parameters and strategies.
[0017] Furthermore, it also includes a data collection and monitoring module, which is used to collect and monitor the query log, execution plan, resource usage and data distribution information of the database in real time; it mainly includes a query log collection submodule, an execution plan analysis submodule, a resource usage monitoring submodule and a data distribution monitoring submodule, wherein, The query log collection submodule is used to capture the SQL statement, query mode, execution time, return result size, used index and storage structure information of each query; The execution plan analysis submodule is used to record the execution plan generated by the query optimizer; Resource usage monitoring submodule, used to monitor CPU, memory, and disk I / O resource usage during query execution; The data distribution monitoring submodule is used to monitor the distribution of data in the database in real time.
[0018] Furthermore, it also includes a security and fault-tolerant mechanism, which is used to ensure that the operation of the adaptive query optimizer will not have a negative impact on the normal operation of the database; it mainly includes an operation audit submodule, a fault-tolerant mechanism submodule and a security check submodule, wherein: The operation audit submodule is used to record all operations performed by the adaptive query optimizer; The fault-tolerance mechanism submodule is used to automatically roll back the operation and restore to the previous state when the optimization operation fails; The security check submodule is used to perform a security check before executing each optimization operation to ensure that there is no adverse impact on the integrity and performance of the database.
[0019] Furthermore, it also includes a performance evaluation and continuous optimization module, which is used to regularly evaluate the effect of the adaptive query optimizer and continuously optimize its performance; it mainly includes a performance benchmark test submodule, a continuous improvement submodule and a user report generation submodule, wherein: The performance benchmark submodule is used to regularly perform performance benchmark tests to evaluate the overall effect of the adaptive query optimizer; Continuously improve submodules to continuously improve optimization algorithms and strategies based on evaluation results and new query patterns to adapt to changing system requirements; The user report generation submodule is used to generate detailed performance reports to show the optimization effects of the optimizer in different time periods.
[0020] Furthermore, the query pattern analysis and classification module includes a query pattern classification submodule, a frequency analysis submodule and a pattern change detection submodule, wherein: A query mode classification submodule, for classifying queries according to features, wherein the features include one or more of range query, exact query, aggregate query and complex JOIN query; The frequency analysis submodule is used to count the execution frequency and average execution time of various queries and identify high-frequency queries and performance bottlenecks. The mode change detection submodule is used to detect the change trend of the query mode.
[0021] Furthermore, the adaptive optimization strategy generation module includes an index recommendation and adjustment submodule, a storage structure optimization submodule and an execution plan adaptive adjustment submodule, wherein: The index recommendation and adjustment submodule is used to automatically recommend new indexes or adjust the structure of existing indexes according to changes in query patterns; The storage structure optimization submodule is used to adjust the data storage structure according to data distribution and query mode; The execution plan adaptive adjustment submodule is used to adjust the cost model of the query optimizer in real time to reflect the current query mode and system status and generate a more efficient execution plan.
[0022] Furthermore, the machine learning and prediction module includes a model training submodule, a pattern prediction submodule and an adaptive learning submodule, wherein: Model training submodule, used to train machine learning models based on historical query data and system performance data; The pattern prediction submodule is used to identify possible high-load query patterns in the future through prediction models and generate optimization strategies in advance; The adaptive learning submodule is used to make adaptive adjustments to adapt to the dynamic changes of the system.
[0023] Furthermore, the real-time optimization and execution module includes a strategy application submodule, a dynamic adjustment submodule and an effect monitoring submodule, wherein: The strategy application submodule is used to apply the generated optimization strategy to the database in real time; Dynamic adjustment submodule, used to dynamically adjust the applied strategies according to the real-time status of the system; The effect monitoring submodule is used to monitor the effect of the optimization strategy in real time.
[0024] Furthermore, the user feedback and custom optimization module includes a user feedback mechanism submodule, a custom parameter setting submodule and a strategy adjustment submodule, wherein: The user feedback mechanism submodule is used to provide a user interface to allow database administrators or senior users to provide feedback on optimization effects; The custom parameter setting submodule allows users to define some parameters of the adaptive optimizer, including the maximum cache size, the number of allowed indexes, and the query type to be optimized first; The strategy adjustment submodule is used to dynamically adjust the optimization strategy based on user feedback and customized parameters.
[0025] The beneficial effect of the present invention is that the present invention effectively improves the performance stability and query efficiency of the time series database by dynamically adjusting the query plan, optimizing resource management, and using machine learning driven continuous optimization. The present invention has broad application prospects in the fields of Internet of Things, financial analysis, industrial Internet of Things, smart cities, and environmental monitoring, and can significantly improve the response speed of the system, reduce maintenance costs, and ensure the real-time and reliability of data queries in key scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present invention 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0027] Figure 1 is a system block diagram of the present invention; Figure 2 It is a logic flow chart of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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 part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0029] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0030] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0031] See also Figure 1 , an adaptive query optimizer for a time series database, including a data collection and monitoring module, a query pattern analysis and classification module, an adaptive optimization strategy generation module, a machine learning and prediction module, a real-time optimization and execution module, a user feedback and custom optimization module, a security and fault tolerance mechanism, and a performance evaluation and continuous optimization module, wherein, Data collection and monitoring module, used to collect and monitor database query logs, execution plans, resource usage and data distribution information in real time; Query pattern analysis and classification module, used to analyze and classify query patterns to identify common query patterns and possible optimization points; Adaptive optimization strategy generation module, used to automatically generate and adjust query optimization strategies based on query pattern analysis results; Machine learning and prediction modules are used to predict future query pattern changes and optimize in advance; Real-time optimization and execution module, used to apply the generated optimization strategy to the database in real time and monitor its effect; User feedback and custom optimization module, used to provide feedback on optimization results and provide custom optimization parameters and strategies; Security and fault tolerance mechanisms to ensure that the operation of the adaptive query optimizer does not negatively impact the normal operation of the database; The performance evaluation and continuous optimization module is used to regularly evaluate the effectiveness of the adaptive query optimizer and continuously optimize its performance.
[0032] In this embodiment, the data collection and monitoring module is used to collect and monitor the query log, execution plan, resource usage and data distribution of the database in real time; it mainly includes a query log collection submodule, an execution plan analysis submodule, a resource usage monitoring submodule and a data distribution monitoring submodule, wherein the query log collection submodule captures the SQL statement, query mode, execution time, return result size, used index and storage structure of each query. The execution plan analysis submodule records the execution plan generated by the query optimizer, including the selected index, scanning method (full table scan, index scan), sorting operation, etc. The resource usage monitoring submodule monitors the CPU, memory, disk I / O and other resource usage during query execution, so as to analyze the consumption of system resources by the query. The data distribution monitoring submodule monitors the distribution of data in the database in real time, including data heat (access frequency), data partitioning, etc.
[0033] In this embodiment, the query pattern analysis and classification module is used to analyze and classify query patterns based on the collected data to identify common query patterns and possible optimization points; it mainly includes a query pattern classification submodule, a frequency analysis submodule and a pattern change detection submodule, wherein the query pattern classification submodule classifies queries according to features, such as range queries, precise queries, aggregate queries, complex JOIN queries, etc. Each type of query has different optimization requirements. The frequency analysis submodule counts the execution frequency and average execution time of various types of queries, and identifies high-frequency queries and performance bottlenecks. The pattern change detection submodule detects the changing trend of the query pattern, such as whether a new query pattern appears, or whether the frequency of certain query patterns increases.
[0034] In this embodiment, the adaptive optimization strategy generation module is used to automatically generate and adjust the query optimization strategy based on the query pattern analysis results; it mainly includes an index recommendation and adjustment submodule, a storage structure optimization submodule and an execution plan adaptive adjustment submodule, wherein the index recommendation and adjustment submodule automatically recommends new indexes or adjusts the structure of existing indexes according to changes in the query pattern. For example, for frequent range queries, it can be recommended to create a range index of timestamps. The storage structure optimization submodule adjusts the storage structure of the data according to the data distribution and query pattern, such as repartitioning, adjusting the partitioning strategy, optimizing the data compression algorithm, etc. The execution plan adaptive adjustment submodule adjusts the cost model of the query optimizer in real time to reflect the current query pattern and system status, and generate a more efficient execution plan. For example, reduce the frequency of full table scans and give priority to indexes that are more suitable for the current query.
[0035] In this embodiment, the machine learning and prediction module is used to use machine learning technology to predict future query pattern changes and optimize in advance; it mainly includes a model training submodule, a pattern prediction submodule and an adaptive learning submodule, wherein the model training submodule trains machine learning models such as decision trees, random forests, deep learning, etc. based on historical query data and system performance data, and the goal of the model is to predict changes in query patterns and resource requirements. The pattern prediction submodule identifies possible high-load query patterns in the future in advance through the prediction model, and generates optimization strategies in advance, such as preheating the cache, adjusting the index, etc. The adaptive learning submodule is used to continuously adaptively adjust to adapt to the dynamic changes of the system, which includes regularly retraining the model or updating the model in real time based on new data.
[0036] In this embodiment, the real-time optimization and execution module is used to apply the generated optimization strategy to the database in real time and monitor its effect; it mainly includes a strategy application submodule, a dynamic adjustment submodule and an effect monitoring submodule, wherein the strategy application submodule applies the generated optimization strategy to the database in real time, such as creating or deleting indexes, adjusting storage structures, updating the cost model of the query optimizer, etc. The dynamic adjustment submodule dynamically adjusts the applied strategy according to the real-time status of the system. For example, when the query load suddenly increases, the cache size is temporarily increased or the index priority is readjusted. The effect monitoring submodule monitors the effect of the optimization strategy in real time, such as query response time, resource utilization efficiency, etc. If a certain strategy is not effective, the strategy can be automatically rolled back or adjusted.
[0037] In this embodiment, the user feedback and custom optimization module allows users to provide feedback on optimization effects and provide custom optimization parameters and strategies; it mainly includes a user feedback mechanism submodule, a custom parameter setting submodule and a strategy adjustment submodule, wherein the user feedback mechanism submodule provides a user interface to allow database administrators or senior users to provide feedback on optimization effects, such as whether the execution speed of certain queries is improved, whether resource consumption is reduced, etc. The custom parameter setting submodule allows users to define some parameters of the adaptive optimizer, such as the maximum cache size, the number of allowed indexes, the query types to be optimized first, etc. The strategy adjustment submodule dynamically adjusts the optimization strategy based on user feedback and custom parameters.
[0038] In this embodiment, the security and fault-tolerant mechanism is used to ensure that the operation of the adaptive query optimizer will not have a negative impact on the normal operation of the database; it mainly includes an operation audit submodule, a fault-tolerant mechanism submodule and a security check submodule, wherein the operation audit submodule records all operations performed by the adaptive query optimizer, such as index creation, storage structure adjustment, etc., so as to backtrack when necessary. When the optimization operation fails, the fault-tolerant mechanism submodule automatically rolls back the operation and restores to the previous state to ensure the stability of the system. The security check submodule performs a security check before executing each optimization operation to ensure that there is no adverse impact on the integrity and performance of the database.
[0039] In this embodiment, the performance evaluation and continuous optimization module is used to regularly evaluate the effect of the adaptive query optimizer and continuously optimize its performance; it mainly includes a performance benchmark test submodule, a continuous improvement submodule and a user report generation submodule, wherein the performance benchmark test submodule regularly performs performance benchmark tests to evaluate the overall effect of the adaptive query optimizer. The continuous improvement submodule continuously improves the optimization algorithm and strategy based on the evaluation results and new query patterns to adapt to the ever-changing system requirements. The user report generation submodule is used to generate a detailed performance report to show the optimization effect of the optimizer in different time periods and help users understand the operation of the system.
[0040] Based on the above design, the adaptive query optimizer will be able to effectively respond to dynamically changing query patterns and improve the overall performance and user experience of the time series database.
[0041] See also Figure 2 ,The optimization logic of the present invention is as follows: first, ,collect query logs and execution plans, monitor resource usage and data distribution, ,analyze and classify query patterns; then, ,identify optimization points and generate optimization strategies, ,predict query pattern changes based on machine learning, and monitor the ,optimization effect in real time. During this process, user feedback and custom ,adjustment optimization strategies are run, and the user-adjusted strategies are ,applied for optimization.
[0042] Based on the above embodiments, the present invention has at least the following technical effects: Dynamic optimization capability: Automatically adjust query plans. The adaptive query optimizer can analyze the current query load and data distribution in real time and automatically adjust the query plan. Compared with traditional static optimizers, it can better cope with changes in query patterns and improve query efficiency. Index and storage structure optimization. The system can automatically recommend or adjust index structures according to actual query requirements and optimize data storage methods, thereby increasing data access speed and reducing storage space waste.
[0043] Intelligent resource management: Improve resource utilization efficiency. By real-time monitoring of system resource usage, the adaptive query optimizer can dynamically adjust resource allocation strategies, such as adjusting cache size and allocating I / O bandwidth, to avoid resource waste and bottleneck problems. Preventive adjustment: Based on predicted query pattern changes, the adaptive query optimizer can adjust system configuration in advance to avoid performance degradation caused by load surges.
[0044] Reduce human intervention: Automated tuning. Traditional query optimization relies on the experience of database administrators, and usually requires manual adjustment of index, storage engine and other configurations. The adaptive query optimizer can automate these operations, reduce human intervention, and reduce maintenance costs. Reduce maintenance difficulty. Database administrators no longer need to frequently analyze and adjust system configurations, reducing the complexity of tuning and the risk of misoperation.
[0045] Improved performance stability: Quickly adapt to query changes. When the query pattern changes, the adaptive query optimizer can quickly adjust the strategy to ensure the stability of system performance and avoid performance fluctuations that may occur with traditional optimizers. Reduce query response time. By intelligently adjusting indexes and execution plans, the adaptive query optimizer can significantly reduce query response time, especially when processing large-scale data.
[0046] Continuous optimization driven by machine learning: Continuous learning and improvement. The system continuously accumulates and analyzes historical query data through machine learning, optimizes the model, and makes adaptive adjustments based on new query patterns, making the system more and more efficient over time. Prediction and prevention. Based on historical data and existing trends, the system can predict possible performance bottlenecks and take measures in advance to prevent system performance degradation.
[0047] Role in some areas Internet of Things (IoT): Massive device data management. The amount of time series data generated by IoT devices is extremely large, and the query patterns are complex and diverse. The adaptive query optimizer can dynamically optimize query performance based on real-time data streams and different query requirements, improving the efficiency of data management and analysis. Anomaly detection and real-time response. In the Internet of Things, real-time monitoring of device status and detection of anomalies are crucial. The adaptive query optimizer can ensure fast response to critical queries, allowing the system to detect and handle device failures or abnormal behaviors in the first place.
[0048] Financial data analysis: High-frequency trading and market analysis. Financial markets require extremely high real-time data, and query requirements are frequent and changeable. The adaptive query optimizer can quickly adapt to different query modes, ensuring that the financial analysis system can process high-frequency trading data in real time and support rapid decision-making. Historical data backtracking and prediction. Financial analysts need to backtrack historical data and predict trends. The optimizer can dynamically adjust data storage and indexing strategies based on query requirements to speed up the analysis of large-scale historical data.
[0049] Industrial Internet of Things and Manufacturing: Real-time Monitoring and Predictive Maintenance. In the manufacturing industry, real-time monitoring of equipment status and predictive maintenance rely on efficient querying of time series data. The adaptive query optimizer can ensure that the system can still process query tasks stably and efficiently when the load changes, reducing equipment failure rate and downtime. Production process optimization. In the manufacturing industry, real-time analysis of production data is critical to optimizing production processes and improving efficiency. The adaptive query optimizer can improve the efficiency of real-time data analysis by dynamically optimizing query plans and data storage methods.
[0050] Smart City: Urban data management and analysis. Smart cities involve data management in multiple fields such as transportation, energy, water, and environment. These data are time-sensitive and the query patterns are complex and diverse. The adaptive query optimizer can adapt to different query scenarios to ensure that the city management system can analyze and respond to various data needs in real time. Emergency response. In the emergency management of smart cities, fast query and analysis of data is the key. The optimizer can ensure that in emergencies, the system can quickly respond to query needs and provide support for emergency decision-making.
[0051] Environmental monitoring and weather forecasting: Real-time data processing. Environmental monitoring and weather forecasting systems need to process a large amount of real-time data, such as air quality, temperature, humidity, etc. The adaptive query optimizer can ensure that the system can process and query this data in real time, improving the accuracy of predictions. Historical data analysis. The analysis of historical meteorological data is helpful for climate change research and long-term predictions. The optimizer can dynamically adjust storage and query strategies to improve the efficiency of large-scale historical data analysis.
[0052] In general, the adaptive query optimizer effectively improves the performance stability and query efficiency of the time series database by dynamically adjusting query plans, optimizing resource management, and using machine learning-driven continuous optimization. It has broad application prospects in the fields of Internet of Things, financial analysis, industrial Internet of Things, smart cities, and environmental monitoring. It can significantly improve the system's response speed, reduce maintenance costs, and ensure the real-time and reliability of data queries in key scenarios.
[0053] For the aforementioned embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily required by the present application.
[0054] The above embodiments describe the basic principles and main features of the present invention and the advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the changes and modifications made by those skilled in the art shall be within the scope of protection of the appended claims of the present invention without departing from the spirit and scope of the present invention.
Claims
1. An adaptive query optimizer for a time series database, characterized in that: It includes query pattern analysis and classification module, adaptive optimization strategy generation module, machine learning and prediction module, real-time optimization and execution module and user feedback and custom optimization module. Query pattern analysis and classification module, used to analyze and classify query patterns to identify common query patterns and possible optimization points; Adaptive optimization strategy generation module, used to automatically generate and adjust query optimization strategies based on query pattern analysis results; Machine learning and prediction modules are used to predict future query pattern changes and optimize in advance; Real-time optimization and execution module, used to apply the generated optimization strategy to the database in real time and monitor its effect; User feedback and custom optimization module, used to provide feedback on optimization results and provide custom optimization parameters and strategies.
2. The adaptive query optimizer for a time series database according to claim 1, characterized in that: It also includes a data collection and monitoring module, which is used to collect and monitor the query log, execution plan, resource usage and data distribution information of the database in real time; it mainly includes a query log collection submodule, an execution plan analysis submodule, a resource usage monitoring submodule and a data distribution monitoring submodule, wherein: The query log collection submodule is used to capture the SQL statement, query mode, execution time, return result size, used index and storage structure information of each query; The execution plan analysis submodule is used to record the execution plan generated by the query optimizer; Resource usage monitoring submodule, used to monitor CPU, memory, and disk I / O resource usage during query execution; The data distribution monitoring submodule is used to monitor the distribution of data in the database in real time.
3. The adaptive query optimizer for a time series database according to claim 2, characterized in that: It also includes a security and fault-tolerant mechanism, which is used to ensure that the operation of the adaptive query optimizer will not have a negative impact on the normal operation of the database; it mainly includes an operation audit submodule, a fault-tolerant mechanism submodule and a security check submodule, wherein: The operation audit submodule is used to record all operations performed by the adaptive query optimizer; The fault-tolerance mechanism submodule is used to automatically roll back the operation and restore to the previous state when the optimization operation fails; The security check submodule is used to perform a security check before executing each optimization operation to ensure that there is no adverse impact on the integrity and performance of the database.
4. The adaptive query optimizer for a time series database according to claim 3, characterized in that: It also includes a performance evaluation and continuous optimization module, which is used to regularly evaluate the effect of the adaptive query optimizer and continuously optimize its performance; It mainly includes performance benchmark submodule, continuous improvement submodule and user report generation submodule, among which: The performance benchmark submodule is used to regularly perform performance benchmark tests to evaluate the overall effect of the adaptive query optimizer; Continuously improve submodules to continuously improve optimization algorithms and strategies based on evaluation results and new query patterns to adapt to changing system requirements; The user report generation submodule is used to generate detailed performance reports to show the optimization effects of the optimizer in different time periods.
5. The adaptive query optimizer for a time series database according to claim 4, characterized in that: The query pattern analysis and classification module includes a query pattern classification submodule, a frequency analysis submodule and a pattern change detection submodule, wherein: A query mode classification submodule, for classifying queries according to features, wherein the features include one or more of range query, exact query, aggregate query and complex JOIN query; The frequency analysis submodule is used to count the execution frequency and average execution time of various queries and identify high-frequency queries and performance bottlenecks. The mode change detection submodule is used to detect the change trend of the query mode.
6. The adaptive query optimizer for a time series database according to claim 5, characterized in that: The adaptive optimization strategy generation module includes an index recommendation and adjustment submodule, a storage structure optimization submodule and an execution plan adaptive adjustment submodule, wherein: The index recommendation and adjustment submodule is used to automatically recommend new indexes or adjust the structure of existing indexes according to changes in query patterns; The storage structure optimization submodule is used to adjust the data storage structure according to data distribution and query mode; The execution plan adaptive adjustment submodule is used to adjust the cost model of the query optimizer in real time to reflect the current query mode and system status and generate a more efficient execution plan.
7. The adaptive query optimizer for a time series database according to claim 6, characterized in that: The machine learning and prediction module includes a model training submodule, a pattern prediction submodule and an adaptive learning submodule, wherein: Model training submodule, used to train machine learning models based on historical query data and system performance data; The pattern prediction submodule is used to identify possible high-load query patterns in the future through prediction models and generate optimization strategies in advance; The adaptive learning submodule is used to make adaptive adjustments to adapt to the dynamic changes of the system.
8. The adaptive query optimizer for a time series database according to claim 7, characterized in that: The real-time optimization and execution module includes a strategy application submodule, a dynamic adjustment submodule and an effect monitoring submodule, wherein: The strategy application submodule is used to apply the generated optimization strategy to the database in real time; Dynamic adjustment submodule, used to dynamically adjust the applied strategies according to the real-time status of the system; The effect monitoring submodule is used to monitor the effect of the optimization strategy in real time.
9. The adaptive query optimizer for a time series database according to claim 8, characterized in that: The user feedback and custom optimization module includes a user feedback mechanism submodule, a custom parameter setting submodule and a strategy adjustment submodule, wherein: The user feedback mechanism submodule is used to provide a user interface to allow database administrators or senior users to provide feedback on optimization effects; The custom parameter setting submodule allows users to define some parameters of the adaptive optimizer, including the maximum cache size, the number of allowed indexes, and the query type to be optimized first; The strategy adjustment submodule is used to dynamically adjust the optimization strategy based on user feedback and customized parameters.
Citation Information
Patent Citations
Automatic relational database optimization method based on cloud platform
CN116881230A
Database query optimization method based on exploration value and query cost
CN117520385A
Data query optimization method for unmanned ship control system
CN118332001A
System And Methodology For Automatic Tuning Of Database Query Optimizer
US20090100004A1
Cited By
Dynamic query optimization method and system based on user SQL (Structured Query Language) statement analysis in database
CN120407610A
Database dynamic query optimization and resource scheduling method, equipment and medium
CN120849458A
A database dynamic query optimization and resource scheduling method, device and medium
CN120849458B
Query acceleration system of column storage database and self-adaptive index construction method
CN120873011A
Flume-based time sequence database dynamic adaptation method and device and medium
CN121051164A
