A method for accelerating Iceberg queries
By dynamically adjusting filtering conditions and the number of index segments, optimizing the index structure solves the problem of data search space expansion in large-scale data set queries, and achieves efficient query and stable performance.
Patent Information
- Application Number
- CN202411034484.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-31
AI Technical Summary
When existing technology processes large-scale, high-dimensional data sets, the prefix matching model between filter conditions and sort keys causes the data search space to expand, affects query performance, and cannot meet real-time requirements.
Obtain the query frequency through the real-time monitoring system, dynamically adjust the filter conditions and index segmentation number, form filter query conditions and binary data, optimize the index structure, and reduce memory usage and query time.
It effectively reduces the memory usage during the query process, speeds up the query speed, improves query efficiency and response time, adapts to different query requirements and data changes, and ensures the stability and reliability of query performance.
Smart Images

Figure CN118568101B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data index optimization, and in particular to an Iceberg query acceleration method. Background Art
[0002] In today's era of rapid information expansion, data processing and query performance are key indicators for measuring the efficiency of information systems, especially in the field of big data processing, such as e-commerce, social networks, financial services and other industries. The amount of data generated and processed every day in these fields is huge, which puts higher requirements on data storage, management and retrieval systems. Traditional data query technology often encounters performance bottlenecks when processing large-scale, high-dimensional data sets, especially when the filtering conditions are complex or the data dimensions are numerous. The query efficiency drops sharply, resulting in a long time for data processing tasks and failing to meet users' real-time requirements.
[0003] The patent document with Chinese patent publication number CN104636502A discloses a data acceleration query method for a query system, including, after the system receives a user query request, first turning to a query analyzer, analyzing the query conditions, and normalizing the query conditions, and then through a file buffer, analyzing whether there are existing result data files that meet the current query conditions, if not, querying from the database, and returning the final result file to the data processor, the data processor filters and sorts the data according to the final query requirements, and returns the result file to the upper application system for page display. Compared with the prior art, the data acceleration query method for a query system of the present invention can greatly reduce the occupancy of database and system resources without increasing hardware investment, and greatly improve the query speed. However, although the method improves the query efficiency to a certain extent, it does not clearly propose to solve the conflict problem of the prefix matching model between the filtering condition and the sorting key in the prior art. In the query processing of large-scale data sets, especially when the filtering conditions are more complex or the data dimensions are more, this prefix matching model may cause a sharp expansion of the data search space, thereby affecting the query performance. The expansion of the search space means that the system needs to scan more data to find matching results, which not only increases the query time, but also increases the system's computational burden and resource consumption. Summary of the invention
[0004] To this end, the present invention provides an Iceberg query acceleration method to overcome the problem in the prior art that the conflict between the filter condition and the prefix matching model of the sort key causes the expansion of the data search space and affects the query performance.
[0005] To achieve the above object, the present invention provides an Iceberg query acceleration method, comprising:
[0006] Step S1, obtaining query conditions in the query platform, and obtaining the number of filter conditions in the query conditions. When the number of filter conditions is greater than the preset number of standard dimensions, obtaining a number of query frequencies corresponding to the filter conditions in the query records of the query platform through a real-time monitoring system, and combining the filter conditions of the standard number of dimensions selected according to all the query frequencies and query records to form a screening query condition, using the real-time monitoring system to obtain the screening memory usage of the query using the screening query condition, and when the screening memory usage is greater than the preset standard memory usage, performing multi-dimensional sorting on all stored data to form binary data;
[0007] Step S2, segmenting the binary data according to a preset standard segmentation bit number, using an index library to form a first index for locating the binary data, using the first index to query the storage interval where the binary data corresponding to the query condition is located, and when the storage interval is not found, obtaining a first memory usage in the process of using the first index to query through a real-time monitoring system, and continuously adjusting the standard segmentation bit number according to the difference between the first memory usage and the standard memory usage and a preset standard bit step until the storage interval is found;
[0008] When a storage interval is queried, the storage interval is partitioned according to the preset standard partition bit number to form several sub-intervals. During the partitioning process, the real-time query frequency of each sub-interval is obtained. When the real-time query frequency is less than the preset standard query frequency, the corresponding sub-interval is marked. When the partitioning is completed, the marked sub-intervals are merged.
[0009] Step S3, obtaining the amount of binary data of each unmarked sub-interval, adjusting the corresponding standard segmentation bit number of the first index according to the amount of binary data of each unmarked sub-interval, the current standard segmentation bit number and the preset target segmentation bit number, performing segmentation according to the adjusted standard segmentation bit number, using the index library to form a second index, using the second index to query the storage location in the storage interval where the binary data corresponding to the query condition is located, obtaining the second memory usage in the process of querying using the second index, and outputting the storage data at the storage location when the difference between the second memory usage and the standard memory usage is less than or equal to the preset standard difference value;
[0010] When the difference between the second memory usage and the standard memory usage is greater than a preset standard deviation, the adjusted number of standard segment bits is corrected according to the difference between the second memory usage and the standard memory usage.
[0011] Furthermore, in step S1, a standard dimension quantity is preset, the number of filter conditions in the query condition is obtained, and the number of filter conditions is compared with the standard dimension quantity.
[0012] If the number of filter conditions is less than the number of standard dimensions, the filter condition is determined not to be a multi-dimensional filter condition, and the query condition is directly used for querying.
[0013] Furthermore, in step S1, when the number of filtering conditions is greater than the preset number of standard dimensions, a number of query frequencies corresponding to the filtering conditions in the query records of the query platform are obtained through the real-time monitoring system, and all query frequencies are compared. The filtering conditions corresponding to the highest query frequency are used as the starting conditions, and the filtering conditions of the standard dimension number are selected and combined in order of query frequency from high to low to form a screening query condition.
[0014] Furthermore, in the step S1, a standard memory usage is preset, a filtered memory usage for querying using the filtered query condition is obtained, and the filtered memory usage is compared with the standard memory usage.
[0015] If the filter memory usage is greater than the standard memory usage, the filter condition is determined to be a multi-dimensional filter condition, and all stored data needs to be sorted multi-dimensionally.
[0016] Further, in the step S2, a standard segmentation bit number, a standard memory usage, and a standard bit step are preset, the binary data is segmented according to the standard segmentation bit number, an index library is used to form a first index for locating the binary data, the first index is used to query the storage interval where the binary data corresponding to the query condition is located, when the storage interval is not queried, the first memory usage in the process of querying using the first index is obtained, when the first memory usage is greater than the standard memory usage, the standard segmentation bit number is continuously adjusted according to the difference between the first memory usage and the standard memory usage and the preset standard bit step until the storage interval is queried, wherein, , N' is the adjusted standard segment number, N is the preset standard segment number, M is the first memory usage, M0 is the standard memory usage, S is the standard number step, The floor operator symbol.
[0017] Furthermore, in step S2, a standard query frequency is preset. When a storage interval is queried, the storage interval is partitioned according to the standard partitioning bit number to form a plurality of sub-intervals. During the partitioning process, the real-time query frequency of each sub-interval is obtained, and the real-time query frequency is compared with the standard query frequency.
[0018] If the real-time query frequency is greater than or equal to the standard query frequency, it is determined that the sub-intervals do not need to be merged at the end of the partition.
[0019] Furthermore, in step S2, if the real-time query frequency is less than the standard query frequency, the corresponding sub-interval is marked, and when the partitioning is completed, the marked sub-intervals are merged.
[0020] Furthermore, in step S3, a target number of segmentation bits is preset, an adjustment factor is calculated based on the target number of segmentation bits and the current standard number of segmentation bits, and the standard number of segmentation bits corresponding to the first index is adjusted based on the adjustment factor and the amount of binary data in each unmarked sub-interval, wherein N”=Q×(Nt / Nc), N” is the adjusted standard number of segmentation bits corresponding to the first index, Q is the amount of binary data in each sub-interval, Nt is the target number of segmentation bits, and Nc is the current standard number of segmentation bits.
[0021] Further, in the step S3, a standard deviation value is preset, segmentation is performed according to the adjusted standard segmentation bit number to form a second index, the second index is used to query the storage position in the storage interval where the binary data corresponding to the query condition is located, the second memory usage in the process of querying using the second index is obtained, the difference between the second memory usage and the standard memory usage is calculated, and the difference and the standard deviation value between the second memory usage and the standard memory usage are compared,
[0022] If the difference between the second memory usage and the standard memory usage is smaller than the standard difference, the storage data at the storage location is output.
[0023] Further, in step S3, when the difference between the second memory usage and the standard memory usage is greater than a preset standard deviation, the adjusted standard segment number is corrected according to the difference between the second memory usage and the standard memory usage, wherein Nx”= , Nx" is the corrected standard segment number, Me is the second memory usage, The floor operator symbol.
[0024] Compared with the prior art, the beneficial effect of the present invention is that by dynamically adjusting the filtering conditions and the number of index segments, the memory usage during the query process is effectively reduced, and the query speed is accelerated. At the same time, it can intelligently partition and merge data storage intervals according to the real-time query frequency, further improving the query efficiency. In addition, by continuously optimizing the index, the method can adapt to different query requirements and data changes, ensuring the stability and reliability of the query performance.
[0025] Furthermore, by presetting the number of standard dimensions and judging whether the filtering conditions constitute multi-dimensional filtering, the query complexity can be effectively reduced when there are fewer filtering conditions. This not only speeds up the query, but also improves the query efficiency, because the system does not need to perform additional multi-dimensional data processing. In addition, this method can also directly use the existing conditions for quick query when the query conditions are relatively simple, thereby saving resources and improving user experience.
[0026] Furthermore, by selecting the filter conditions with the highest query frequency for combination, this method can ensure that the filter query conditions are more in line with the user's query habits and needs, thereby improving the relevance and accuracy of the query. In addition, since the filter conditions are dynamically selected based on the query frequency, this method is also very adaptive and can be adjusted as the user's query behavior changes, maintaining the timeliness and effectiveness of the query conditions. This method also helps to reduce unnecessary data scanning and reduce system resource consumption, thereby improving overall query performance and response speed.
[0027] Furthermore, by analyzing the query frequency and giving priority to the filter conditions with high query frequency, this method can identify and focus on the dimensions that users query most frequently, thereby improving the pertinence and efficiency of the query. This method can not only reduce unnecessary data processing and memory usage, but also speed up the query and improve the query response time. In addition, by dynamically selecting the filter conditions with high query frequency, this method can adapt to the changes in user query habits, continuously optimize query performance, and provide users with more accurate and efficient query services.
[0028] Furthermore, by dynamically adjusting the number of segments to optimize memory usage and query efficiency, we ensure that memory consumption during the query process remains within a controllable range. In this way, the system can locate and access data more effectively, reduce unnecessary memory usage, and thus improve query performance and response speed. In addition, by continuously adjusting until the query is successful, the system demonstrates good adaptability, can cope with different query requirements and data sizes, and provide users with stable and reliable query services.
[0029] Furthermore, by monitoring the query frequency of subintervals in real time and comparing it with the standard query frequency, this method can intelligently identify subintervals with high frequency of access and avoid unnecessary merging operations. The benefit of this is that it can reduce the query latency for subintervals with high access frequency, because merging operations may increase the complexity of the query path and query time. In addition, this method also helps to optimize the use of storage space, because only those subintervals with low query frequency will be merged, thereby reducing storage redundancy.
[0030] Furthermore, by marking sub-intervals with query frequencies below the standard and merging them at the end of the partition, this method helps optimize the data storage structure, reduce data redundancy, and improve the efficiency of storage space. The merge operation can simplify data indexing, making the query process more efficient while reducing the demand for system resources. In addition, this method can also make the system more flexible to changes in query patterns. By merging sub-intervals with low frequency of access, more resources can be freed up for more frequently accessed data, thereby improving overall query performance and user experience.
[0031] Furthermore, the index segmentation is dynamically adjusted according to the data volume and the target segmentation number, so as to locate the data more accurately and improve the query efficiency. This method enables the index structure to adaptively respond to data changes, optimizes the use of memory and storage resources, reduces unnecessary data scanning, and speeds up the query speed. In addition, by adjusting the index segmentation, the system can also better balance the query load and avoid overcrowding in certain hot data areas, thereby improving the stability and reliability of the entire system.
[0032] Furthermore, by precisely controlling memory usage, it is ensured that resource consumption during the query process remains within a reasonable range. By setting the standard deviation value, the system can determine whether the current memory usage meets expectations, thereby deciding whether to output the data at the storage location. If the difference between the second memory usage and the standard memory usage is less than the standard deviation value, it means that the memory usage is within an acceptable range, and the system will output the required storage data. This approach not only improves the efficiency and response speed of queries, but also helps maintain the stability of the system because it prevents performance issues that may be caused by excessive memory usage.
[0033] Furthermore, by dynamically correcting the number of standard segments based on actual memory usage, this approach enables the system to more finely control memory consumption and ensure that resource usage during the query process remains within a preset reasonable range. This adaptive adjustment mechanism helps improve the query efficiency and stability of the system because it reduces the risk of performance degradation or system failure due to excessive memory usage. In addition, this dynamic adjustment also helps optimize overall system performance because it allows the system to respond quickly based on the current query load and memory usage, thereby maintaining efficiency and stability in different query scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 Schematic diagram of the process of Iceberg query acceleration method of this embodiment;
[0035] Figure 2 The determination logic diagram for determining the filtering conditions in this embodiment;
[0036] Figure 3 is a decision logic diagram for sub-interval merging decision in this embodiment;
[0037] Figure 4 The decision logic diagram for storing data decision for the sub-interval output of this embodiment. DETAILED DESCRIPTION
[0038] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0039] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0040] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.
[0041] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0042] See also Figure 1 As shown, it is a schematic diagram of the process of the Iceberg query acceleration method of this embodiment;
[0043] This embodiment provides an Iceberg query acceleration method, including:
[0044] Step S1, obtaining query conditions in the query platform, and obtaining the number of filter conditions in the query conditions. When the number of filter conditions is greater than the preset number of standard dimensions, obtaining a number of query frequencies corresponding to the filter conditions in the query records of the query platform through a real-time monitoring system, and combining the filter conditions of the standard number of dimensions selected according to all the query frequencies and query records to form a screening query condition, using the real-time monitoring system to obtain the screening memory usage of the query using the screening query condition, and when the screening memory usage is greater than the preset standard memory usage, performing multi-dimensional sorting on all stored data to form binary data;
[0045] Step S2, segmenting the binary data according to a preset standard segmentation bit number, using an index library to form a first index for locating the binary data, using the first index to query the storage interval where the binary data corresponding to the query condition is located, and when the storage interval is not found, obtaining a first memory usage in the process of using the first index to query through a real-time monitoring system, and continuously adjusting the standard segmentation bit number according to the difference between the first memory usage and the standard memory usage and a preset standard bit step until the storage interval is found;
[0046] When a storage interval is queried, the storage interval is partitioned according to the preset standard partition bit number to form several sub-intervals. During the partitioning process, the real-time query frequency of each sub-interval is obtained. When the real-time query frequency is less than the preset standard query frequency, the corresponding sub-interval is marked. When the partitioning is completed, the marked sub-intervals are merged.
[0047] Step S3, obtaining the amount of binary data of each unmarked sub-interval, adjusting the corresponding standard segmentation bit number of the first index according to the amount of binary data of each unmarked sub-interval, the current standard segmentation bit number and the preset target segmentation bit number, performing segmentation according to the adjusted standard segmentation bit number, using the index library to form a second index, using the second index to query the storage location in the storage interval where the binary data corresponding to the query condition is located, obtaining the second memory usage in the process of querying using the second index, and outputting the storage data at the storage location when the difference between the second memory usage and the standard memory usage is less than or equal to the preset standard difference value;
[0048] When the difference between the second memory usage and the standard memory usage is greater than a preset standard deviation, the adjusted number of standard segment bits is corrected according to the difference between the second memory usage and the standard memory usage.
[0049] First, the number of query conditions and filter conditions is obtained, and then a certain number of filter conditions are selected and combined according to the query frequency to form a filtering query condition. Next, the stored data is sorted multidimensionally to create binary data and the first index to locate the data storage interval. If the memory usage exceeds the standard during the query process, the number of segment bits is adjusted until the storage interval is successfully located. After that, the storage interval is partitioned and marked and merged according to the real-time query frequency to optimize the index. Finally, the number of segment bits of the index is adjusted according to the amount of binary data and memory usage to form a second index, and it is used to query the data storage location. If the memory usage is significantly different from the standard, the number of segment bits will be adjusted to optimize the query performance.
[0050] By dynamically adjusting the filtering conditions and the number of index segments, the memory usage during the query process is effectively reduced, speeding up the query. At the same time, it can intelligently partition and merge data storage intervals according to the real-time query frequency, further improving the query efficiency. In addition, by continuously optimizing the index, this method can adapt to different query requirements and data changes, ensuring the stability and reliability of query performance.
[0051] An e-commerce platform needs to perform fast queries on its huge order data. In this scenario, the preset number of standard dimensions may be 5, because user queries usually involve several key dimensions such as date, user ID, order status, etc. The first memory usage is assumed to be 300MB, which is the actual memory used by the system when executing queries under the filter query conditions. The standard memory usage is set to 500MB to ensure that the system can still run stably under high load. With these settings, the system can efficiently process complex queries while keeping resource consumption within a controllable range, improving user satisfaction and system performance.
[0052] Dimension is a classification standard or attribute of data, which is used to organize data for effective analysis and query. In multidimensional data analysis, dimensions are used to group data so that data can be observed and understood from different perspectives.
[0053] The preset number of standard dimensions is an upper limit set by the system when filtering conditions, which depends on the complexity of the data and the diversity of the queries. It is usually set to a moderate value obtained from the historical query analysis of the data platform. For an e-commerce platform, it is necessary to quickly query its huge order data. Therefore, this embodiment is set to 5, which can avoid unnecessary complex processing on simple queries and improve query efficiency.
[0054] The first memory usage is the actual amount of memory consumed when performing a query after the filtering query conditions are formed. It depends on the complexity of the query and the amount of data returned. It is usually set based on system resources and historical query data. In this embodiment, it is set to 300MB, which can ensure that the query does not consume too much memory and affect system stability.
[0055] The standard memory usage refers to a standard or upper limit of memory usage set by the system, which depends on system resources and performance requirements and is usually set to a certain proportion of the system's maximum memory capacity. In this embodiment, it is set to 500MB, which can be used as a comparison benchmark to help maintain system performance and stability.
[0056] Multidimensional sorting is a method of sorting data according to multiple dimensions. In this embodiment, Zorder sorting is selected based on Iceberg's open source implementation of Z-Order in AWS. Zorder sorting takes the value of each dimension into consideration and arranges the data in Z space. Therefore, even if the optimal matching model is not met during the query, it will not lead to the expansion of the query space.
[0057] The standard segmentation bit is the number of segmentation bits used when creating an index, which depends on the data scale and query accuracy requirements. It is usually set based on data distribution and query requirements. In this embodiment, it is set to 4 bits. Reasonable segmentation can optimize the index structure and speed up the query.
[0058] The index library provides a built-in index library for most relational database management systems, such as MySQL, PostgreSQL, SQLite, etc., supporting different types of indexes such as B-tree, hash, and full-text indexes.
[0059] The first index is an index used to quickly locate data. Depending on the data structure and query mode, it can reduce the data scanning range and improve query efficiency.
[0060] The second index is an index structure obtained through further optimization and adjustment based on the first index. It is used for another data location during the query process, with the purpose of improving query efficiency and reducing memory usage.
[0061] The second memory usage is the actual memory consumption when using the second index query, which depends on the complexity of the second index and the amount of data queried. It is usually set based on system resources and performance goals. In this embodiment, it is set to 200MB. Compared with the first index, the second index reduces memory consumption due to optimization.
[0062] The preset standard bit step is the increment when adjusting the number of segmentation bits, which depends on the system design and query performance requirements and is usually set to a smaller integer, such as 1. In this embodiment, it is set to 1 and can be gradually adjusted to find the optimal number of segmentation bits to balance query efficiency and resource consumption.
[0063] The storage location is the specific location of binary data in the storage system during data processing and query. The query operation is accelerated by building an index. The index contains metadata for quickly locating data, which may include the storage location information of the data.
[0064] The storage interval is the interval or range of data storage, which depends on the physical storage and organization of the data. It is usually set according to the data storage structure, which can clearly identify the data location and facilitate quick access.
[0065] The standard partition bit number is the number of bits used when partitioning the storage interval, which depends on the data scale and query granularity. It is usually set based on the data volume and query requirements. In this embodiment, it is set to 3 bits, which can improve the pertinence and efficiency of the query.
[0066] The standard query frequency refers to the standard or benchmark of the query frequency set by the system, which depends on the user behavior analysis and query mode. It is usually set based on historical query data. In this embodiment, it is set to 10 queries per minute, which can intelligently identify high-frequency access intervals and optimize resource allocation.
[0067] The target number of segment bits is the expected number of segment bits, which is used to adjust the index and depends on query efficiency and data management requirements. It is usually set to an optimized value. In this embodiment, it is assumed to be 6 bits, which can be dynamically adjusted to adapt to data changes and improve index efficiency.
[0068] The standard deviation value is the maximum difference between the allowed memory usage and the standard memory usage, which depends on performance requirements and resource constraints. It is usually set based on system stability and performance testing. In this embodiment, it is set to 100MB, which can ensure that memory usage is within a controllable range and avoid performance problems.
[0069] The filtering memory usage is the amount of memory consumed when querying using the filtering query conditions. This concept was proposed in the process of optimizing query performance. The purpose is to control the occupation of system memory resources by query operations, thereby ensuring the stability and efficiency of the system. It depends on the complexity of the query conditions. The more and more complex the query conditions are, the more memory is required. This is usually determined based on the system's maximum memory capacity, historical query data, and performance testing. In this embodiment, the preset standard memory usage is 500MB, then the filtering memory usage may be set to a value close to but not exceeding this value, such as 450MB, to ensure that there is enough memory space to process queries and keep the system running smoothly. By setting the filtering memory usage, memory overflow or system crash caused by query operations can be avoided, ensuring the stability of the system.
[0070] Please continue reading Figure 2 As shown, it is a decision logic diagram for determining the filtering conditions in this embodiment;
[0071] Specifically, in step S1, the number of standard dimensions is preset, the number of filter conditions in the query condition is obtained, and the number of filter conditions is compared with the number of standard dimensions.
[0072] If the number of filter conditions is less than the number of standard dimensions, the filter condition is determined not to be a multi-dimensional filter condition, and the query condition is directly used for querying.
[0073] First, determine the number of filter conditions in the query condition and compare it with the preset number of standard dimensions. If the number of filter conditions does not exceed the preset number of standard dimensions, the system will determine that the current filter conditions are insufficient to form a multi-dimensional filter condition. In this case, the system will directly use these filter conditions for querying, avoiding unnecessary complex processing, thereby simplifying the query process.
[0074] By presetting the number of standard dimensions and judging whether the filtering conditions constitute multi-dimensional filtering, the query complexity can be effectively reduced when there are fewer filtering conditions. This not only speeds up the query, but also improves the query efficiency because the system does not need to perform additional multi-dimensional data processing. In addition, this method can also directly use the existing conditions for quick query when the query conditions are relatively simple, thereby saving resources and improving the user experience.
[0075] Specifically, in step S1, when the number of filtering conditions is greater than the preset number of standard dimensions, a number of query frequencies corresponding to the filtering conditions in the query records of the query platform are obtained through the real-time monitoring system, and all query frequencies are compared. The filtering conditions corresponding to the highest query frequency are used as the starting conditions, and the filtering conditions of the standard dimension number are selected and combined in order of query frequency from high to low to form a screening query condition.
[0076] When the number of filter conditions exceeds the preset number of standard dimensions, the system first collects the query frequencies corresponding to these filter conditions in the query records of the query platform. Then, the system compares the query frequencies of all filter conditions and selects the filter condition with the highest query frequency as the starting condition for the filter query. Next, the system continues to select filter conditions in descending order of query frequency until the preset number of standard dimensions is reached. In this way, the system can combine a set of filter conditions with the highest query frequency to form a filter query condition for subsequent query operations.
[0077] By selecting the filter conditions with the highest query frequency for combination, this method can ensure that the filter query conditions are more in line with the user's query habits and needs, thereby improving the relevance and accuracy of the query. In addition, since the filter conditions are dynamically selected based on the query frequency, this method is also very adaptive and can be adjusted as the user's query behavior changes, maintaining the timeliness and effectiveness of the query conditions. This method also helps to reduce unnecessary data scanning and reduce system resource consumption, thereby improving overall query performance and response speed.
[0078] Specifically, in step S1, a standard memory usage is preset, a filtered memory usage for querying using a filtered query condition is obtained, and the filtered memory usage is compared with the standard memory usage.
[0079] If the filter memory usage is greater than the standard memory usage, the filter condition is determined to be a multi-dimensional filter condition, and all stored data needs to be sorted in a multi-dimensional manner;
[0080] If the filter memory usage is less than or equal to the standard memory usage, it is determined that the filter condition is not a multi-dimensional filter condition and the query is performed directly.
[0081] When the number of filter conditions in a query exceeds the preset number of standard dimensions, the Iceberg query acceleration method retrieves the query frequencies corresponding to these filter conditions in the query records of the query platform. The system will select the filter condition with the highest query frequency as the starting condition according to the order of query frequency from high to low, and then select other filter conditions with high query frequency in turn until the standard number of dimensions is reached. In this way, the system can combine a set of filter conditions with the highest query frequency to form a screening query condition to optimize query performance.
[0082] By analyzing the query frequency and giving priority to the filter conditions with high query frequency, this method can identify and focus on the dimensions that users query most frequently, thereby improving the pertinence and efficiency of queries. This method can not only reduce unnecessary data processing and memory usage, but also speed up queries and improve query response time. In addition, by dynamically selecting filter conditions with high query frequency, this method can adapt to changes in user query habits, continuously optimize query performance, and provide users with more accurate and efficient query services.
[0083] Specifically, in step S2, a standard segmentation bit number, a standard memory usage, and a standard bit step are preset, the binary data is segmented according to the standard segmentation bit number, an index library is used to form a first index for locating the binary data, and the first index is used to query the storage interval where the binary data corresponding to the query condition is located. When the storage interval is not found, the first memory usage in the process of querying using the first index is obtained. When the first memory usage is greater than the standard memory usage, the standard segmentation bit number is continuously adjusted according to the difference between the first memory usage and the standard memory usage and the preset standard bit step until the storage interval is found. , N' is the adjusted standard segment number, N is the preset standard segment number, M is the first memory usage, M0 is the standard memory usage, S is the standard number step, is the floor rounding operator symbol;
[0084] First, the binary data is segmented according to the preset standard segmentation bit size, and the first index is created to locate the data. When the corresponding storage interval cannot be queried using the first index, the system will measure the memory usage during the query process. If this memory usage exceeds the preset standard memory usage, the system will adjust the segmentation bit size based on the difference between the two and the preset standard bit step size.
[0085] By dynamically adjusting the number of segments, memory usage and query efficiency are optimized to ensure that memory consumption during the query process remains within a controllable range. In this way, the system can locate and access data more effectively, reduce unnecessary memory usage, and thus improve query performance and response speed. In addition, by continuously adjusting until the query is successful, the system demonstrates good adaptability, can cope with different query requirements and data sizes, and provide users with stable and reliable query services.
[0086] Please continue reading Figure 3 As shown, it is a decision logic diagram of sub-interval merging decision in this embodiment;
[0087] Specifically, in step S2, a standard query frequency is preset. When a storage interval is queried, the storage interval is partitioned according to the standard partition bit number to form a number of sub-intervals. During the partitioning process, the real-time query frequency of each sub-interval is obtained, and the real-time query frequency is compared with the standard query frequency.
[0088] If the real-time query frequency is greater than or equal to the standard query frequency, it is determined that the sub-intervals do not need to be merged at the end of the partition.
[0089] After successfully querying the storage interval, the storage interval will be subdivided according to the preset standard partition bit number to create multiple sub-intervals. While partitioning, the system will monitor and obtain the query frequency of these sub-intervals in real time. Then, the system compares these real-time query frequencies with the preset standard query frequency. If the real-time query frequency of a sub-interval reaches or exceeds the standard query frequency, the system will determine that the sub-interval does not need to be merged with other sub-intervals after the partitioning process is completed, so as to maintain its independence.
[0090] By monitoring the query frequency of subintervals in real time and comparing it with the standard query frequency, this method can intelligently identify subintervals with high frequency of access and avoid unnecessary merge operations. The benefit of this is that it can reduce the query latency for subintervals with high access frequency, because merge operations may increase the complexity of the query path and query time. In addition, this method also helps to optimize the use of storage space, because only those subintervals with low query frequency will be merged, thereby reducing storage redundancy.
[0091] Specifically, in step S2, if the real-time query frequency is less than the standard query frequency, the corresponding sub-interval is marked, and when the partitioning is completed, the marked sub-intervals are merged.
[0092] When the system partitions the queried storage interval according to the standard partition bit number to form several sub-intervals, it will monitor the query frequency of these sub-intervals in real time. If the real-time query frequency of a sub-interval is lower than the preset standard query frequency, the system will mark this sub-interval. After the partitioning process is completed, all marked sub-intervals will be merged into a larger interval to reduce the complexity of maintenance and improve the efficiency of data management.
[0093] By marking sub-intervals with query frequencies below the standard and merging them at the end of the partition, this method helps optimize the data storage structure, reduce data redundancy, and improve the efficiency of storage space. The merge operation can simplify data indexing, making the query process more efficient while reducing the demand for system resources. In addition, this method can also make the system more flexible to changes in query patterns. By merging sub-intervals with low frequency of access, more resources can be freed up for more frequently accessed data, thereby improving overall query performance and user experience.
[0094] Specifically, in step S3, a target number of segmentation bits is preset, an adjustment factor is calculated based on the target number of segmentation bits and the current standard number of segmentation bits, and the standard number of segmentation bits corresponding to the first index is adjusted based on the adjustment factor and the amount of binary data in each unmarked sub-interval, wherein N”=Q×(Nt / Nc), N” is the adjusted standard number of segmentation bits corresponding to the first index, Q is the amount of binary data in each sub-interval, Nt is the target number of segmentation bits, and Nc is the current standard number of segmentation bits.
[0095] The target segmentation number is introduced to further optimize the segmentation of the index. The system first calculates an adjustment factor based on the ratio of the target segmentation number Nt to the current standard segmentation number Nc. Then, the system multiplies this adjustment factor with the amount of binary data Q in each unlabeled subinterval to obtain a new standard segmentation number N" for the first index.
[0096] Dynamically adjust the index segmentation according to the amount of data and the target segmentation number, so as to locate data more accurately and improve query efficiency. This method enables the index structure to adaptively respond to data changes, optimizes the use of memory and storage resources, reduces unnecessary data scanning, and speeds up queries. In addition, by adjusting the index segmentation, the system can also better balance the query load and avoid overcrowding in certain hot data areas, thereby improving the stability and reliability of the entire system.
[0097] The amount of binary data in each subinterval is the total amount of binary data contained in each subinterval after the storage interval is partitioned according to the preset standard partition bit number in step S2. This data volume reflects the scale of data stored in each subinterval, and is a key factor in query optimization and memory management. It depends on the physical distribution and organization of the data, and is usually set depending on the design and performance goals of the system. Ideally, the amount of binary data in a subinterval should be balanced, neither too large to consume too much memory, nor too small to cause overhead due to frequent queries. In this embodiment, in the order data scenario of an e-commerce platform, the amount of binary data in each subinterval can be determined based on the number of orders and the size of each order data. For example, if a subinterval represents a product category, then the amount of data in this subinterval will depend on the number of orders in that category.
[0098] Assume that we set the amount of binary data in each subinterval to not exceed a certain threshold, such as 100MB. The advantage of this is that it can control the memory usage and prevent a single query operation from consuming too much memory, which would affect the stability and response speed of the system.
[0099] In addition, a reasonable data size setting can make queries more efficient because smaller data sets are easier to scan and process quickly.
[0100] The order data of the e-commerce platform is stored in monthly partitions. The amount of order data for each month is approximately the following binary data volume:
[0101] January: 90MB;
[0102] February: 110MB;
[0103] March: 80MB, ….
[0104] The standard memory usage is 500MB, and the maximum memory usage of a single query operation is expected to be no more than 300MB. Therefore, adjust the amount of data in each sub-interval, such as by compressing or merging smaller sub-intervals, to ensure that the amount of binary data in each sub-interval does not exceed 300MB.
[0105] Please continue reading Figure 4 As shown, it is a decision logic diagram for determining the sub-interval output storage data in this embodiment;
[0106] Specifically, in step S3, a standard deviation value is preset, segmentation is performed according to the adjusted standard segmentation bit number to form a second index, the second index is used to query the storage location in the storage interval where the binary data corresponding to the query condition is located, the second memory usage in the process of querying using the second index is obtained, the difference between the second memory usage and the standard memory usage is calculated, and the difference between the second memory usage and the standard memory usage and the standard deviation value are compared.
[0107] If the difference between the second memory usage and the standard memory usage is smaller than the standard difference, the storage data at the storage location is output.
[0108] First, the data is segmented according to the adjusted standard segmentation bit number to form a second index. Using this second index, the system queries the exact storage location within the storage interval where the binary data corresponding to the specified query condition is located. During the query process, the system measures and records the memory usage of the second index query. Then, the system calculates the difference between this second memory usage and the preset standard memory usage, and compares it with the preset standard deviation value.
[0109] By precisely controlling memory usage, we ensure that resource consumption during the query process remains within a reasonable range. By setting the standard deviation value, the system can determine whether the current memory usage is in line with expectations, and thus decide whether to output the data at the storage location. If the difference between the second memory usage and the standard memory usage is less than the standard deviation value, it means that the memory usage is within an acceptable range, and the system will output the required storage data. This approach not only improves the efficiency and response speed of queries, but also helps maintain system stability because it prevents performance issues that may be caused by excessive memory usage.
[0110] Specifically, in step S3, when the difference between the second memory usage and the standard memory usage is greater than a preset standard deviation, the adjusted standard segment number is corrected according to the difference between the second memory usage and the standard memory usage, wherein Nx”= , Nx" is the corrected standard segment number, Me is the second memory usage, The floor operator symbol.
[0111] When the difference between the second memory usage Me and the preset standard memory usage M0 during the second index query exceeds the preset standard deviation value, the system will take action to adjust the query strategy. Specifically, the system will correct the adjusted standard segment number N" according to the ratio of the second memory usage exceeding the standard memory usage.
[0112] By dynamically correcting the number of standard segments based on actual memory usage, this approach enables the system to more finely control memory consumption and ensure that resource usage during the query process remains within a preset reasonable range. This adaptive adjustment mechanism helps improve the query efficiency and stability of the system because it reduces the risk of performance degradation or system failure due to excessive memory usage. In addition, this dynamic adjustment also helps optimize overall system performance because it allows the system to respond quickly based on the current query load and memory usage, thereby maintaining efficiency and stability in different query scenarios.
[0113] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An Iceberg query acceleration method, characterized in that: include: Step S1: Obtain query conditions in the query platform and the number of filter conditions in the query conditions. When the number of filter conditions is greater than the preset number of standard dimensions, obtain a number of query frequencies corresponding to the filter conditions in the query records of the query platform through a real-time monitoring system, and select filter conditions of the standard number of dimensions based on all the obtained query frequencies and query records to form a screening query condition. Use the real-time monitoring system to obtain the screening memory usage of the query using the screening query condition. When the screening memory usage is greater than the preset standard memory usage, perform multi-dimensional sorting on all stored data to form binary data. Step S2: Segmenting the binary data according to a preset standard segmentation bit number, using an index library to form a first index for locating the binary data, using the first index to query a storage interval containing the binary data corresponding to the query condition, and if the storage interval is not found, obtaining a first memory usage during the query using the first index through a real-time monitoring system, and continuously adjusting the standard segmentation bit number based on the difference between the first memory usage and the standard memory usage and a preset standard bit step size until the storage interval is found; When a storage interval is found, the storage interval is partitioned according to the preset standard partitioning bit number to form several sub-intervals. During the partitioning process, the real-time query frequency of each sub-interval is obtained. When the real-time query frequency is less than the preset standard query frequency, the corresponding sub-interval is marked. When the partitioning is completed, the marked sub-intervals are merged. Step S3: Obtain the amount of binary data in each unmarked subinterval, adjust the standard segmentation bit number of the corresponding first index according to the amount of binary data in each unmarked subinterval, the current standard segmentation bit number, and the preset target segmentation bit number, perform segmentation according to the adjusted standard segmentation bit number, use the index library to form a second index, use the second index to query the storage location within the storage interval where the binary data corresponding to the query condition is located, and obtain the second memory usage during the query using the second index. When the difference between the second memory usage and the standard memory usage is less than or equal to a preset standard deviation value, outputting the stored data at the storage location; When the difference between the second memory usage and the standard memory usage is greater than a preset standard deviation, the adjusted number of standard segment bits is corrected according to the difference between the second memory usage and the standard memory usage.
2. The Iceberg query acceleration method according to claim 1, wherein: In step S1, the number of standard dimensions is preset, the number of filter conditions in the query condition is obtained, and the number of filter conditions is compared with the number of standard dimensions. If the number of filter conditions does not exceed the number of standard dimensions, the filter condition is determined not to be a multi-dimensional filter condition, and the query condition is directly used for the query.
3. The Iceberg query acceleration method according to claim 2, wherein: In step S1, when the number of filtering conditions is greater than the preset number of standard dimensions, the real-time monitoring system is used to obtain several query frequencies corresponding to the filtering conditions in the query records of the query platform, and all query frequencies are compared. The filtering condition corresponding to the highest query frequency is used as the starting condition, and the filtering conditions of the standard dimension number are selected and combined in order of query frequency from high to low to form a screening query condition.
4. The Iceberg query acceleration method according to claim 3, wherein: In step S1, a standard memory usage is preset, the filtered memory usage of the query using the filtered query condition is obtained, and the filtered memory usage is compared with the standard memory usage. If the filtering memory usage is greater than the standard memory usage, the filtering condition is determined to be a multi-dimensional filtering condition, and all stored data needs to be multi-dimensionally sorted.
5. The Iceberg query acceleration method according to claim 4, wherein: In step S2, a standard segmentation bit number, a standard memory usage, and a standard bit step are preset. The binary data is segmented according to the standard segmentation bit number, and an index library is used to form a first index for locating the binary data. The first index is used to query the storage interval where the binary data corresponding to the query condition is located. When the storage interval is not found, the first memory usage in the process of querying using the first index is obtained. When the first memory usage is greater than the standard memory usage, the standard segmentation bit number is continuously adjusted according to the difference between the first memory usage and the standard memory usage and the preset standard bit step length until the storage interval is found. , N' is the adjusted standard segment number, N is the preset standard segment number, M is the first memory usage, M0 is the standard memory usage, S is the standard number step, The floor operator symbol.
6. The Iceberg query acceleration method according to claim 5, characterized in that: In step S2, a standard query frequency is preset. When a storage interval is queried, the storage interval is partitioned according to the standard partitioning bit to form several sub-intervals. During the partitioning process, the real-time query frequency of each sub-interval is obtained, and the real-time query frequency is compared with the standard query frequency. If the real-time query frequency is greater than or equal to the standard query frequency, it is determined that the sub-intervals do not need to be merged at the end of the partition.
7. The Iceberg query acceleration method according to claim 6, characterized in that: In step S2, if the real-time query frequency is less than the standard query frequency, the corresponding sub-interval is marked, and at the end of the partitioning, the marked sub-intervals are merged.
8. The Iceberg query acceleration method according to claim 7, wherein: In step S3, a target number of segmentation bits is preset, and an adjustment factor is calculated based on the target number of segmentation bits and the current standard number of segmentation bits. The standard number of segmentation bits corresponding to the first index is adjusted based on the adjustment factor and the amount of binary data in each unmarked subinterval, wherein N”=Q×(Nt / Nc), N” is the adjusted standard number of segmentation bits corresponding to the first index, Q is the amount of binary data in each subinterval, Nt is the target number of segmentation bits, and Nc is the current standard number of segmentation bits.
9. The Iceberg query acceleration method according to claim 8, wherein: In step S3, a standard deviation value is preset, segmentation is performed according to the adjusted standard segmentation bit number to form a second index, the second index is used to query the storage location in the storage interval where the binary data corresponding to the query condition is located, the second memory usage in the process of querying using the second index is obtained, the difference between the second memory usage and the standard memory usage is calculated, and the difference between the second memory usage and the standard memory usage and the standard deviation value are compared. If the difference between the second memory usage and the standard memory usage is smaller than the standard deviation, the stored data at the storage location is output.
10. The Iceberg query acceleration method according to claim 9, wherein: In step S3, when the difference between the second memory usage and the standard memory usage is greater than a preset standard deviation, the adjusted number of standard segment bits is corrected according to the difference between the second memory usage and the standard memory usage, wherein Nx”=⌊N”×[1+(Me-M0) / M0]⌋, Nx” is the corrected number of standard segment bits, Me is the second memory usage, The floor operator symbol.
Citation Information
Patent Citations
Accelerated data query method of query system
CN104636502A
Data query method and device
CN112434057A
Internet of Things data processing method and device, equipment and medium
CN115357609A
Query method and related equipment
CN117591744A
Event hierarchies and memory organization for structured data retrieval
US20080281857A1
