Report query method and device based on materialized view

By pre-calculating the pre-query request before data query and building a materialized view, the problems of low data query efficiency and high resource consumption in the prior art are solved, and efficient and low-cost data query is achieved.

CN119759972AInactive Publication Date: 2025-04-04BEIJING ZHONGQI YUNLIAN IND FINANCE TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411940707.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, data queries based on original data have problems such as low query efficiency, large system resource consumption and high data query cost.

Method used

By obtaining the query dimensions and aggregation logic in the prequery request, pre-calculation results are obtained, and a materialized view is constructed based on the pre-calculation results. When querying the original data, the results are directly queryed from the materialized view to avoid repeated calculations.

Benefits of technology

It improves the efficiency of data query, saves query time, reduces system load, and reduces system resource consumption and data query cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759972A_ABST
    Figure CN119759972A_ABST
Patent Text Reader

Abstract

The invention provides a report query method and device based on a materialized view, and the method comprises the steps: obtaining a to-be-queried report which comprises multiple pieces of dimension information; obtaining a pre-query request, extracting a query dimension and aggregation logic in the pre-query request, and determining dimension information corresponding to the query dimension from the to-be-queried report based on the extracted query dimension, determining to-be-aggregated data information from the to-be-queried report based on the extracted aggregation logic and the determined dimension information corresponding to the query dimension, and obtaining a pre-calculation result through the aggregation logic based on the to-be-aggregated data information; constructing a materialized view based on the pre-calculation result, wherein the materialized view comprises an aggregation result corresponding to the aggregation logic; and obtaining a to-be-queried request, extracting an aggregation request in the to-be-queried request, and extracting an aggregation result in the materialized view based on the aggregation request as a query result corresponding to the to-be-queried request. According to the method, the data query efficiency is improved, and the consumption of system resources and the data query cost are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data technology, and in particular to a report query method and device based on materialized views. Background Art

[0002] At present, data modeling in the field of big data follows five levels: original storage layer, detail layer, dimension layer, aggregation layer and application layer; data modeling is the process of cleaning, stratifying, aggregating and associating data through reasonable methods; when the quality of original data is too low, the indicators are too many and too complex, or the query cost is too high due to lack of aggregation, the original data can be modeled to obtain easy-to-understand and usable data results. However, the common contradiction in real data modeling is that the modeling process is difficult to keep up with the pace of business development, and it is difficult to measure the return on investment of data modeling work; therefore, many data development engineers may no longer perform data modeling and directly use the original data, which inevitably leads to problems such as low data query efficiency; and applications in the data warehouse environment often perform complex queries based on multiple large tables, usually involving the association and aggregation of billions of rows of data between multiple tables; processing such queries usually consumes a lot of system resources and time, resulting in extremely high query costs.

[0003] In summary, the current data query based on raw data not only has the technical problem of low query efficiency, but also increases the consumption of system resources and data query costs. Therefore, how to improve the efficiency of data query based on raw data and reduce the consumption of system resources and data query costs is a technical problem that needs to be solved urgently. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a report query method and device based on materialized views to eliminate or improve one or more defects existing in the prior art.

[0005] One aspect of the present invention provides a report query method based on materialized views, the method comprising:

[0006] Obtaining a report to be queried, the report to be queried includes multiple dimensional information, each of the dimensional information includes multiple pieces of data information;

[0007] Obtaining a pre-query request, extracting a query dimension and an aggregation logic in the pre-query request, determining dimension information corresponding to the query dimension from the report to be queried based on the extracted query dimension, determining data information to be aggregated from the report to be queried based on the extracted aggregation logic and the determined dimension information corresponding to the query dimension, and obtaining a pre-calculation result based on the data information to be aggregated through the aggregation logic;

[0008] Building a materialized view based on the pre-calculated result, wherein the materialized view includes an aggregation result corresponding to the aggregation logic;

[0009] The query request to be queried is obtained, an aggregation request in the query request to be queried is extracted, and an aggregation result in the materialized view is extracted based on the aggregation request as a query result corresponding to the query request to be queried.

[0010] In some embodiments of the present invention, the number of the pre-query requests is multiple.

[0011] In some embodiments of the present invention, extracting the query dimension and aggregation logic in the pre-query request includes:

[0012] Respectively extracting a first query dimension and a second query dimension in the first pre-query request and the second pre-query request, and extracting the same query dimension based on the first query dimension and the second query dimension;

[0013] Respectively extracting a first aggregation logic and a second aggregation logic in the first pre-query request and the second pre-query request, and extracting similar aggregation logic based on the first aggregation logic and the second aggregation logic;

[0014] The same query dimension and the similar aggregation logic are used as the query dimension and the aggregation logic in the pre-query request.

[0015] In some embodiments of the invention, the method comprises:

[0016] Get the data information to be updated;

[0017] Based on the data information to be updated and the data information to be aggregated, the pre-calculation result is updated by the aggregation logic;

[0018] An updated materialized view is obtained based on the updated pre-calculation result.

[0019] In some embodiments of the present invention, obtaining a report to be queried includes:

[0020] Get multiple subreports;

[0021] The multiple sub-reports are associated to obtain the report to be queried.

[0022] In some embodiments of the present invention, the method further comprises:

[0023] Partitioning the report to be queried to obtain multiple partition tables;

[0024] The materialized views corresponding to the partition tables are constructed respectively.

[0025] In some embodiments of the present invention, the report to be queried is an order table, the dimension information includes order ID dimension, customer ID dimension, order date dimension, order total amount dimension and order status dimension, and the aggregation logic includes an aggregation function.

[0026] According to another aspect of the present invention, a report query system based on materialized views is also disclosed. The system includes a processor, a memory, and a computer program stored in the memory. The processor is used to execute the computer program. When the computer program is executed, the system implements the steps of the method described in any of the above embodiments.

[0027] According to yet another aspect of the present invention, a computer-readable storage medium is disclosed, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0028] According to yet another aspect of the present invention, a computer program product is disclosed, including a computer program, which implements the steps of the method described in any of the above embodiments when executed by a processor.

[0029] The materialized view-based report query method and device disclosed in the above-mentioned embodiment of the present invention first pre-calculate the query dimension and aggregation logic in the pre-query request to obtain the pre-calculation result, and then generate the materialized view based on the pre-calculation result; then, when querying the original data, the intermediate result is directly queried from the materialized view as the query result of the query request to be queried, avoiding further query and calculation of the original data. This method not only improves the data query efficiency and saves query time, but also further reduces the load, reduces the consumption of system resources and the data query cost.

[0030] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.

[0031] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention. The components in the drawings are not drawn to scale, but are only for illustrating the principles of the present invention. In order to facilitate the illustration and description of some parts of the present invention, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present invention. In the drawings:

[0033] Figure 1 The present invention is a flowchart of a report query method based on materialized views according to an embodiment of the present application.

[0034] Figure 2 A flowchart of a report query method based on materialized views according to another embodiment of the present application.

[0035] Figure 3 A schematic diagram of materialized view partitions corresponding to a partition table according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0037] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.

[0038] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0039] It should also be noted here that, unless otherwise specified, the term "connection" in this article can refer not only to a direct connection, but also to an indirect connection with an intermediary, not only to a wired connection, but also to a wireless connection, and the specific connection can be changed based on the actual application scenario.

[0040] In order to better understand the present invention, the terms related to the technical solution are explained as follows:

[0041] A materialized view is a database object that contains query results, is a local copy of remote data, or is used to generate summary tables based on the sum of data tables. A materialized view stores data based on remote tables and can also be called a snapshot.

[0042] Query rewrite: When querying a base table that has a materialized view, the system automatically determines whether the pre-calculated results in the materialized view can be reused to process the query; if it can be reused, the system will directly read the pre-calculated results from the relevant materialized view to avoid repeated calculations that consume system resources and time.

[0043] Refresh: After creating an asynchronous materialized view, the data in it only reflects the state of the base table at the time of creation. When the data in the base table changes, you need to refresh the asynchronous materialized view to update the data changes. Refresh includes asynchronous refresh and manually triggered refresh; asynchronous refresh means that whenever the data in the base table changes, the materialized view automatically triggers the refresh task according to the specified refresh interval; manually triggered refresh means that the materialized view will not refresh automatically, and the user needs to manually maintain the refresh task.

[0044] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0045] Figure 1 FIG. 1 is a flow chart of a report query method based on materialized view according to an embodiment of the present application. Figure 1 As shown, the report query method based on materialized view at least includes steps S10 to S40.

[0046] Step S10: Obtain a report to be queried, wherein the report to be queried includes multiple dimensional information, and each dimensional information includes multiple pieces of data information.

[0047] The report to be queried can also be called a base table, and multiple pieces of data information of multiple dimensions are stored in the report to be queried. Exemplarily, the report to be queried can be an order table, and the dimensional information included in the order table is: order ID (order_id) dimension, customer ID (customer_id) dimension, order date (order_date) dimension, order total amount (amount) dimension, and order status (status) dimension. In the order table, each dimension includes multiple pieces of data information. It can be understood that using the order table as the report to be queried is only an example. In other embodiments, it can also be other types of reports to be queried besides the order table, and the number of dimensional information contained in the report to be queried can also be more or less, and the type of specific dimension can also be set based on actual needs.

[0048] Step S20: Obtain a pre-query request, extract the query dimension and aggregation logic in the pre-query request, determine the dimension information corresponding to the query dimension from the report to be queried based on the extracted query dimension, determine the data information to be aggregated from the report to be queried based on the extracted aggregation logic and the determined dimension information corresponding to the query dimension, and obtain a pre-calculated result based on the data information to be aggregated through the aggregation logic.

[0049] In this step, pre-calculation is completed based on the pre-query request to obtain the pre-calculation result. The pre-query request contains query dimensions and aggregation logic. The aggregation logic includes aggregation calculations on the query dimensions, such as aggregation logic including aggregation functions, such as summing and averaging multiple data. The query dimension is one or more of the multiple dimensional information in the report to be queried, that is, after extracting the query dimension in the pre-query request, further determine the dimensional information that is the same as the query dimension from the report to be queried; after determining the dimensional information that needs to be aggregated, further extract the data information to be aggregated that needs to be calculated from the multiple data information under the dimensional information based on the calculation conditions or calculation requirements in the aggregation logic, and further pre-calculate the data information to be aggregated based on the aggregation function to obtain the pre-calculation result.

[0050] Exemplarily, the report to be queried is an order table, and the dimensional information in the order table includes order ID dimension, customer ID dimension, order date dimension, order total amount dimension, and order status dimension. In this embodiment, the pre-query request is exemplarily to summarize the total amount of orders in 2023. The query dimension extracted based on the pre-query request is the total amount of orders dimension, and the aggregation logic includes an aggregation function and a date condition. Exemplarily, the date condition is: sale_date>='2023-01-01' and sale_date<'2024-01-01', the aggregation function is a total amount calculation formula, and the pre-calculated result obtained based on the query dimension extracted from the pre-query request and the aggregation logic is the total amount of 2023.

[0051] In some embodiments of the present invention, the number of pre-query requests is multiple, such as the pre-query request includes a first pre-query request and a second pre-query request. In this case, repeated aggregate queries in the multiple pre-query requests are further extracted, and pre-calculated results are generated based on the query dimensions and aggregation logic corresponding to the repeated aggregate queries. It can be understood that the multiple pre-query requests consisting of the first pre-query request and the second pre-query request listed in this embodiment are only some examples. In other embodiments, the multiple pre-query requests may also include a third pre-query request, a fourth pre-query request, etc.

[0052] Further, when the pre-query request includes a first pre-query request and a second pre-query request, extracting the query dimension and aggregation logic in the pre-query request includes:

[0053] Extract the first query dimension and the second query dimension in the first pre-query request and the second pre-query request respectively, and extract the same query dimension based on the first query dimension and the second query dimension; extract the first aggregation logic and the second aggregation logic in the first pre-query request and the second pre-query request respectively, and extract similar aggregation logic based on the first aggregation logic and the second aggregation logic; use the same query dimension and the similar aggregation logic as the query dimension and aggregation logic in the pre-query request.

[0054] In the above embodiment, the same query dimensions and similar aggregation logic in the first pre-query request and the second pre-query request are first extracted, so as to complete the calculation of the pre-calculation results based on the extracted same query dimensions and similar aggregation logic. Exemplarily, taking the order table as an example, the dimensional information in the order table includes the order ID dimension, the customer ID dimension, the order date dimension, the total order amount dimension and the order status dimension; then the first pre-query request is exemplarily to summarize the total order amount in 2023 and the number of orders in a certain area, and the second pre-query request is exemplarily to summarize the total order amount in 2024 and the number of customers in a certain area; then the first query dimension corresponding to the first pre-query request first extracted at this time is the total order amount dimension and the order ID dimension, and the second query dimension corresponding to the second pre-query request is the total order amount dimension and the customer ID dimension. Further judgment shows that the same query dimension contained in the first query dimension and the second query dimension is the total order amount dimension; in addition, the first aggregation logic corresponding to the extracted first pre-query request is the date condition is sal e_date>='2023-01-01' and sale_date<'2024-01-01', and the total amount aggregation function of the order total quantity aggregation function with order ID XX, the second aggregation logic corresponding to the extracted second pre-query request is the total amount aggregation function with date condition sale_date>='2024-01-01' and sale_date<'2025-01-01', and the total number aggregation function of the customer with customer ID XX; further judge the similarity between the above-mentioned first aggregation logic and the second aggregation logic, and extract similar aggregation logic from the first aggregation logic and the second aggregation logic, then the extracted similar aggregation logic is: calculate the annual total amount for each year based on the total amount aggregation function, that is, the similar aggregation logic in the first aggregation logic and the second aggregation logic includes the total amount aggregation function and the annual calculation condition.

[0055] In the above embodiment with multiple pre-query requests, the to-be-queried report is pre-calculated based on the same query dimension and similar aggregation logic finally obtained. Exemplarily, the following is a code example corresponding to the similar aggregation logic for identifying pre-query requests:

[0056]

[0057] Step S30: constructing a materialized view based on the pre-calculated result, wherein the materialized view includes an aggregation result corresponding to the aggregation logic.

[0058] This step further constructs a materialized view based on the pre-calculated result obtained in step S20, and the materialized view includes an aggregation result corresponding to the aggregation logic.

[0059] In the above order table, the pre-calculation result is the annual total amount pre-calculation result obtained by summarizing the total amount of each year. At this time, the materialized view includes the annual total amount corresponding to each year. Exemplarily, the code included in constructing the materialized view is:

[0060]

[0061] It can be understood that the materialized view construction method listed in the above embodiment and the annual total amount pre-calculation results contained in the materialized view are all examples and do not constitute a limitation of the materialized view of the present application.

[0062] Step S40: obtaining the request to be queried, extracting the aggregation request in the request to be queried, and extracting the aggregation result in the materialized view based on the aggregation request as the query result corresponding to the request to be queried.

[0063] After the materialized view is constructed for the report to be queried, the request to be queried is further obtained, the aggregation request is directly obtained from the request to be queried, and the aggregation result corresponding to the aggregation request is further extracted from the materialized view as the request result corresponding to the request to be queried. Exemplarily, the materialized view includes the pre-calculated results of the total amount of each year, and the aggregation request in the request to be queried is a request to calculate the total amount of orders in 2023. At this time, the pre-calculated results of the total amount corresponding to 2023 can be directly extracted from the materialized view; it can be seen that the report query method based on the materialized view does not need to repeatedly query the original data in the base table and repeat the aggregation calculation during the specific query, and the query result corresponding to the request to be queried can be directly queried from the materialized view. Therefore, this method can not only improve the query efficiency, but also further reduce the consumption of system resources and data query costs.

[0064] After the materialized view is created, the code used by the query request to directly reference the materialized view is as follows:

[0065]

[0066]

[0067] In the above embodiment, a materialized view is constructed by extracting similar aggregation logic in the pre-query request to accelerate repeated aggregation queries; that is, there may be a large number of queries containing the same aggregate function sub-queries in the data warehouse environment, which occupy a large amount of computing resources. This application further establishes an asynchronous materialized view based on the above pre-query request, calculates and saves all results of the pre-query request; Figure 2 As shown, after the materialized view is successfully established, the system will automatically rewrite the query statement to directly query the intermediate results in the asynchronous materialized view, thereby reducing the load and speeding up the query.

[0068] In some embodiments of the present invention, the report query method based on materialized view also includes the following steps: obtaining data information to be updated; updating the pre-calculated result through the aggregation logic based on the data information to be updated and the data information to be aggregated; and obtaining the updated materialized view based on the updated pre-calculated result. In this embodiment, the materialized view is refreshed as the data in the base table is updated. Specifically, the refresh can be automatic refresh or manual refresh. If it is automatic refresh, the automatic refresh rules can be further set, such as setting the time interval for automatic refresh, or starting the automatic refresh when the data update in the base table is detected; if it is manual refresh, the refresh of the materialized view can be manually completed according to the refresh requirements.

[0069] In another embodiment, the report query method based on materialized view may further include the following steps: obtaining multiple sub-reports; associating the multiple sub-reports to obtain the report to be queried. This embodiment obtains the report to be queried based on the association of multiple sub-reports, that is, first constructs a materialized view for the report to be queried formed by the association of multiple sub-reports, and then obtains the query result based on the materialized view. This embodiment applies the report query method based on materialized view to the base table that needs to be associated. This embodiment not only saves the query and aggregation time of the original data in the base table during the data query process, but also further saves the time required for the sub-report association operation.

[0070] Exemplarily, the association operation of multiple sub-reports can be automatic association or manual association. Automatic association is similar to automatic refresh, and the association interval time or the trigger condition of key operations can be set. Manual association is also similar to manual refresh. Manual association can manually complete the association operation of multiple sub-reports based on actual needs. In addition, when the re-association operation occurs, the materialized view can also be refreshed accordingly, so that the materialized view corresponds to the report to be queried.

[0071] In the above embodiment, if it is necessary to regularly associate multiple sub-reports in the data warehouse to generate a new wide table, an asynchronous materialized view can be established and regular refresh rules can be set to avoid manually scheduling association tasks; after the asynchronous materialized view is successfully established, the query will directly return results based on the asynchronous materialized view, thereby avoiding delays caused by association operations.

[0072] In one embodiment, there are two sub-reports, which are the order table and the customer table. The dimension information contained in the order table is: order ID dimension, customer ID dimension, order date dimension, order total amount dimension and order status dimension. The dimension information contained in the customer table is: customer ID (customer_id) dimension, customer name (customer_name) dimension, customer region (region) dimension, customer email (customer_email) dimension and registration date (registration_date) dimension. The two sub-reports are associated to generate a wide table, which contains customer information and corresponding order records. In this embodiment, a materialized view is constructed based on the wide table formed by the association. The code corresponding to the construction process of the materialized view is as follows:

[0073]

[0074] In some embodiments of the present invention, the report query method based on materialized view also includes the following steps: partitioning the report to be queried to obtain multiple partition tables; respectively constructing materialized views corresponding to each of the partition tables. In this embodiment, the fact table is partitioned, associated with the dimension table, and the materialized view is updated under the trigger condition; illustratively, the partition key of a specific base table (usually the fact table) is specified in the partition key of the materialized view to realize the partition association of the materialized view; when the data in a partition of the associated base table changes, the corresponding partition in the materialized view will be refreshed, but other partitions will not be affected (refer to Figure 3 ); According to the actual application scenario, the fact table can be partitioned to a fine-grained level, such as by day or by hour; and after the fact table is updated, the corresponding partitions in the materialized view will be automatically refreshed. Taking the order table as an example, the code corresponding to creating a partition is:

[0075] CREATE TABLE orders_2024_01PARTITION OF orders FOR VALUES FROM('2024-01-01')TO('2024-01-31');

[0076] CREATE TABLE orders_2024_02PARTITION OF orders FOR VALUES FROM('2024-02-01')TO('2024-02-29');

[0077] The code corresponding to building a materialized view based on the partition table is:

[0078]

[0079] In addition to the report query method based on materialized view disclosed in the above embodiment, it is also possible to further establish multi-layer asynchronous materialized view for data to realize data warehouse stratification, that is, to decompose complex queries into multi-layer simple queries, and the relationship between layers can be traced; it can not only reduce repeated calculations, but also help maintenance personnel quickly locate problems. In addition, data warehouse stratification can also decouple raw data from statistical data, thereby protecting sensitive raw data.

[0080] Through the above embodiments, it can be found that the present application first pre-calculates the query dimensions and aggregation logic in the pre-query request to obtain the pre-calculated results, and then generates a materialized view based on the pre-calculated results; and then when querying the original data, the intermediate results are directly queried from the materialized view as the query results of the query request to be queried, avoiding further querying and calculating the original data. This method not only improves the query efficiency of the data and saves query time, but also further reduces the load, reduces the consumption of system resources and data query costs. In addition, the report query method does not need to maintain other data processing systems or components, saving physical resources; it executes complex query pre-stored results regularly, and obtains pre-stored results when the interface request arrives, with fast response and high support for concurrency.

[0081] Accordingly, the present invention provides a report query system based on materialized views, the system comprising a processor, a memory and a computer program stored in the memory, the processor being used to execute the computer program, and when the computer program is executed, the system implements the steps of the method described in any of the above embodiments.

[0082] The embodiments of the present invention also provide a computer-readable storage medium and a computer program product, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in any of the above embodiments are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0083] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0084] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0085] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0086] 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 embodiments of 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. A report query method based on materialized view, characterized in that: The method comprises: Obtaining a report to be queried, the report to be queried includes multiple dimensional information, each of the dimensional information includes multiple pieces of data information; Obtaining a pre-query request, extracting a query dimension and an aggregation logic in the pre-query request, determining dimension information corresponding to the query dimension from the report to be queried based on the extracted query dimension, determining data information to be aggregated from the report to be queried based on the extracted aggregation logic and the determined dimension information corresponding to the query dimension, and obtaining a pre-calculation result based on the data information to be aggregated through the aggregation logic; Building a materialized view based on the pre-calculated result, wherein the materialized view includes an aggregation result corresponding to the aggregation logic; The query request to be queried is obtained, an aggregation request in the query request to be queried is extracted, and an aggregation result in the materialized view is extracted based on the aggregation request as a query result corresponding to the query request to be queried.

2. The report query method based on materialized view according to claim 1 is characterized in that: The number of the pre-query requests is multiple.

3. The report query method based on materialized view according to claim 2 is characterized in that: Extracting the query dimension and aggregation logic in the pre-query request includes: Respectively extracting a first query dimension and a second query dimension in the first pre-query request and the second pre-query request, and extracting the same query dimension based on the first query dimension and the second query dimension; Respectively extracting a first aggregation logic and a second aggregation logic in the first pre-query request and the second pre-query request, and extracting similar aggregation logic based on the first aggregation logic and the second aggregation logic; The same query dimension and the similar aggregation logic are used as the query dimension and the aggregation logic in the pre-query request.

4. The report query method based on materialized view according to claim 1 is characterized in that: The method comprises: Get the data information to be updated; Based on the data information to be updated and the data information to be aggregated, the pre-calculation result is updated by the aggregation logic; An updated materialized view is obtained based on the updated pre-calculation result.

5. The report query method based on materialized view according to claim 1 is characterized in that: Get the report to be queried, including: Get multiple subreports; The multiple sub-reports are associated to obtain the report to be queried.

6. The report query method based on materialized view according to claim 1 is characterized in that: The method further comprises: Partitioning the report to be queried to obtain multiple partition tables; The materialized views corresponding to the partition tables are constructed respectively.

7. The report query method based on materialized view according to claim 1 is characterized in that: The report to be queried is an order table, the dimension information includes order ID dimension, customer ID dimension, order date dimension, order total amount dimension and order status dimension, and the aggregation logic includes aggregation function.

8. A report query system based on materialized views, the system comprising a processor, a memory and a computer program stored in the memory, characterized in that: The processor is used to execute the computer program. When the computer program is executed, the system implements the steps of the method according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Query acceleration method and device based on materialized view, electronic equipment and medium

    CN117688032A

  • Index query method and device, electronic equipment and readable storage medium

    CN118394800A

Cited By

  • Materialized view construction method, data processing system, medium and program product

    CN120386793A