Dimensional context propagation technology for optimizing SQL query plans
By associating dimensional context with fact scanning operations in the query plan, the query plan is optimized, solving the problems of high cost and resource waste in multidimensional analysis queries, and enabling fast and efficient querying of large-scale multidimensional data.
Patent Information
- Application Number
- CN201980008847.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-16
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2039-01-16
AI Technical Summary
Existing technologies suffer from high query execution costs, resource waste, and query performance bottlenecks when performing multidimensional analysis queries, especially self-organizing queries. Pre-aggregation technology leads to loss of granularity and cannot effectively handle self-organizing queries.
By identifying fact-scanning operations in the original query plan and associating them with dimensional context, the query plan can be optimized to generate an enhanced query plan, reducing unnecessary data processing and resource consumption.
It improves query execution speed, reduces CPU cycles and memory resource usage, enables efficient interactive querying of large-scale multidimensional data, and avoids the granularity loss problem caused by pre-aggregation.
Smart Images

Figure CN111971666B_ABST
Abstract
Description
[0001] References to other applications
[0002] This application claims the benefit of and priority to the following applications, which are incorporated herein by reference in their entirety for all purposes:
[0003] (1) U.S. Provisional Application No. 62 / 617,970, filed on January 16, 2018, entitled “DIMENSION CONTEXT PROPAGATION TECHNIQUE FOR ANALYTICAL SQL QUERIES”;
[0004] (2) U.S. Provisional Application No. 62 / 747,642, filed on October 18, 2018, entitled “DIMENSION CONTEXT PROPAGATION TECHNIQUE FOR ANALYTICAL SQL QUERIES”; and
[0005] (3) U.S. nonprovisional application Ser. No. 16 / 248,061, filed on January 15, 2019, entitled “DIMENSION CONTEXT PROPAGATION TECHNIQUES FOR OPTIMIZING SQL QUERY PLANS” Technical Field
[0006] The present disclosure generally relates to query execution. More specifically, techniques for enhancing query execution performance are described. Various inventive embodiments are described herein, including methods, systems, and non-transitory computer-readable storage media storing programs, codes, or instructions executable by one or more processors. Background Art
[0007] Analytical solutions enable enterprises to better understand the different activities of their business across dimensions such as time, space, products, and customers. This can include performing contextual or correlation analysis, performance management, what-if analysis, forecasting, slice and dice analysis, key performance indicators (KPIs) and trend analysis, dashboards, etc. The key aspect of any multidimensional analysis is the dimensional context that specifies both the focus of the analysis and the inputs to the analysis.
[0008] Online analytical processing (OLAP) database systems are often used to mine data and generate reports in order to gain insights or extract useful patterns about various business-related activities. For example, OLAP databases can be used to identify sales trends, analyze marketing activities, and predict financial performance. This typically involves evaluating analytical queries against large amounts (e.g., millions of records) of multidimensional database data. For example, sales data can be analyzed based on dimensions such as time, geographic region, department, and / or individual products.
[0009] Analysts typically think of semantic models for their data. Data is often thought of in terms of dimensions and measures, where measures capture details about an activity (e.g., sales, quantity sold) and dimensions capture the context of the activity (e.g., type of product sold, store where the sale occurred, state where the store is located, customer who made the purchase, etc.). Business data is typically multidimensional and semantically rich.
[0010] A large number of data analysis solutions use relational database systems as the backend, and certain query languages such as SQL (Structured Query Language) are used as analysis languages. Multidimensional database data typically includes fact records that store metrics (e.g., sales data), which are stored separately from dimension records that store dimensions or contextual information (e.g., time data, geographic data, department data, product data). For example, fact records can be stored in fact tables, while dimension records can be stored in dimension tables.
[0011] In the SQL world, analytical solutions are built on a star schema (so named because of its appearance in an entity-relationship (ER) diagram, see Figure 4 ) and use SQL queries to query. Typical analytical queries may involve several building block query subplans / common table expressions combined by joins or unions. The query subplan for the query usually involves joining the fact table with the dimension table and performing aggregation calculations on slices of the multidimensional space. Most of the cost of executing the query is usually the scanning of the source of the fact record. In addition, analyzing fact records based on dimension records often involves joining fact records with dimension records, for example, joining fact tables with dimension tables. However, joining fact records with dimension records may be computationally intensive, at least because it involves processing a large number of fact records. Some prior arts focus on optimizing query execution by using pre-computation (such as using OLAP cubes, extracts, and materialized pre-aggregated tables). However, the execution improvements provided by these technologies are still limited. In addition, pre-aggregation has several disadvantages, such as loss of granularity, inability to run ad-hoc queries, etc.
[0012] Compounding the computational overhead is the way in which database queries are often drafted and evaluated. The drafting of database queries is generally outsourced to database programmers who have little to no domain or contextual knowledge. Additionally, drafting such queries in languages such as SQL is very difficult. Different parts of the query are often evaluated in isolation, and this can lead to unnecessary and repetitive data processing. For example, due to the way the queries are written, a query plan for a query may specify filtering operations at a later stage in the query plan. When query plan operations are performed at an early stage in the query plan without regard to filtering operations, much of the data processing performed at the early stages may be rendered useless because much of the data processed at the early stages may be filtered out as irrelevant data at a later stage. Summary of the invention
[0013] The present disclosure generally relates to query execution. More specifically, techniques for enhancing query execution performance are described. Various inventive embodiments are described herein, including methods, systems, and non-transitory computer-readable storage media storing programs, codes, or instructions executable by one or more processors.
[0014] The present disclosure generally relates to techniques for efficiently executing analytical queries such as self-organizing database queries. For queries such as SQL self-organizing queries, the query plan generated for the query is optimized and enhanced and rewritten as an optimized or enhanced query plan. The enhanced query plan uses fewer CPU cycles when executed than the original non-optimized query plan and is therefore executed faster than the original query plan. Therefore, the query for which the enhanced query plan is generated executes faster without compromising the results obtained or the data being queried. In some embodiments, the optimized or enhanced query plan also uses fewer memory resources when executed than the original non-optimized query plan.
[0015] In some embodiments, the original query plan is optimized by identifying a set of one or more fact scan operations / operators in the original query plan and then associating a dimension context with one or more of the set of fact scan operations in the rewritten enhanced query plan. In some embodiments, the dimension context is associated with the fact scan operation by associating one or more predicate conditions (also referred to as dimension context predicate conditions) corresponding to the dimension context with the fact scan operation. A fact scan operation is an operation in a query plan that is configured to scan or read facts (also referred to as fact records or fact rows) from a source of fact records (also referred to as a fact source). The association of the predicate conditions with the fact scan operation in the enhanced query plan is also referred to as the propagation of the predicate conditions or dimension context to the fact scan operation or the propagation of the predicate conditions or dimension context to the fact source (the fact scan operation operates on the fact source). Due to the association or propagation, the total cost of scanning / reading and / or processing fact records in the enhanced query plan is much lower than that of the original query plan. Therefore, the enhanced query plan uses fewer CPU cycles than the original non-optimized query plan when executing, and therefore executes faster than the original query plan.
[0016] In some embodiments, the process of optimizing a query plan may include identifying which one or more fact scan operations in the query plan are candidates for predicate condition propagation, identifying one or more predicate conditions to be associated with each candidate fact scan operation, and then rewriting the query plan with the association. The query plan for executing the query with the association. Various different techniques disclosed herein may be used to perform this process.
[0017] Various different techniques can be used to identify the predicate conditions to be associated with the fact scanning operation. For example, the predicate conditions from one part of the original query plan can be propagated to the fact scanning operation in another part of the query plan in the rewritten enhanced query plan. As an example, the dimension predicate conditions applied to the dimension table in one part of the query plan can be propagated and associated with the fact scanning operation in another part of the query plan. In some other cases, instead of associating a specific predicate condition with the fact scanning operation, a new predicate condition (also referred to as the conversion or mapping of a specific predicate condition or the original predicate condition to the new predicate condition) is inferred from the specific predicate condition or the original predicate condition in the query plan, and the new predicate condition is associated with the fact scanning operation instead of the specific predicate condition. The new predicate condition makes the cost (e.g., execution time) of executing the fact scanning operation with the new predicate condition less than the cost of executing the fact scanning operation with the specific predicate condition or the original predicate condition. In some cases, instead of scanning the fact records in the fact table referenced in the query, other physical fact structures (fact sources) (such as OLAP indexes, pre-aggregated materialized views) can be used to perform scanning.
[0018] As indicated above, the enhanced query plan uses fewer CPU cycles when executed than the original non-optimized query plan, and therefore executes faster than the original query plan. There are a variety of ways to achieve this. In some cases, due to the association of predicate conditions with fact scan operations in the query plan, the number of fact records processed by the rewritten query plan is reduced compared to the original query plan. For example, as a result of the association of predicate conditions with fact scan operations, only fact records that satisfy the predicate conditions are provided from the fact scan operation to the next downstream operation in the query plan. This reduces the number of fact records provided to downstream operations (e.g., join operations between fact tables and dimension tables) in the enhanced query plan and that must be processed by downstream operations. This reduces the computational overhead associated with executing downstream operations in the enhanced query plan. This filtering of fact records based on predicate conditions reduces unnecessary and repeated processing of fact records by the query plan. The reduction in the number of fact records processed by the query plan translates into faster execution times for the query plan and the query itself for which the query plan is generated. The reduction in the number of fact records processed by the query plan can also translate into fewer memory resources for executing the rewritten query plan. As described above, in some embodiments, a new predicate condition inferred or converted from a specific predicate condition can be associated with a fact scan operation rather than a specific predicate condition. The new predicate condition makes the cost (e.g., execution time) of executing a fact scan operation with the new predicate condition less than the cost of executing a fact scan operation with a specific predicate condition. For example, a fact scan operation associated with a specific predicate condition may take 2 seconds to execute, while the same fact scan operation associated with the new predicate condition may only take 1 second to execute. The inference or conversion of the predicate condition enables the enhanced query plan to execute faster than an unoptimized query plan. In addition, in some embodiments, faster execution time is achieved by performing a fact scan on an available alternative fact representation (such as an OLAP index) in such a manner so as to fully utilize the scanning capabilities of the fact representation. For example, conversion to an OLAP index scan of certain predicates "P" allows the combination to fully utilize fast predicate evaluation and skip the scan of the OLAP index, thereby resulting in a reduction in the magnitude of fact scan processing in some cases.
[0019] From a performance perspective, the enhanced query plan can execute faster and potentially use fewer resources than the unenhanced query plan. A large number of queries executed based on the teachings disclosed herein execute 10, 25, or even 100 times or even more orders of magnitude faster than queries executed with unenhanced query plans. This is because fact tables are several orders of magnitude larger than dimension tables, so reducing the scan costs associated with processing fact records brings huge performance improvements. For example, in one case, the query execution time of a self-organizing query was reduced from 206 seconds to 16 seconds.
[0020] Various different pieces of information can be used to facilitate the query plan optimization described herein. In some embodiments, the query plan generated for a database query can be optimized and enhanced based on the following conditions: the structure of the query, the structure of the query plan generated for the query, the schema information related to the database being queried, and the semantic information that can be used for the query plan optimizer and / or enhancer. For example, business semantics or business intelligence (BI) semantic information can be used to rewrite the query plan. Semantic information can include business data with rich value and structural semantics based on real-world processing, organizational structure, etc. Semantic information can include information related to the business model, such as business hierarchies and functional dependencies in data. For example, dependency information can include information describing the relationship (e.g., hierarchical or non-hierarchical) between different fields (e.g., columns) of database data. For example, dependency metadata can include information describing the hierarchical relationship between the value of the "city" column and the value of the "state" column (e.g., San Francisco is a city in California). Examples of hierarchies include time period hierarchies (e.g., days, weeks, months, quarters, years, etc.), geographic hierarchies (e.g., cities, states, countries / regions), etc. In some embodiments, semantic information can be determined based on analyzing information about the structure and schema of a database storing the data being analyzed, without any user input. Inferences drawn from such analysis can be used to rewrite query plans to generate optimized and enhanced query plans.
[0021] In some embodiments, an original query plan generated for a query for querying data stored in a relational database may be received. The original query plan may include a first fact scan operation configured to scan fact records from a source of fact records. The original query plan may also include a second operation configured to receive a set of records from the first scan operation. A first predicate condition to be associated with the first fact scan operation is identified. The original query plan may be rewritten to generate an enhanced query plan, wherein, in the enhanced query plan, the first predicate condition is associated with the first scan operation, and the second operation receives only those one or more scanned fact records that satisfy the predicate condition. Due to the association of the first predicate condition with the first scan operation, the enhanced query plan executes faster than the original query plan. The enhanced query plan may be executed to obtain a result record set for the query. The result record set may be provided as a response to the query.
[0022] The data being queried by the query (or the data on which the query operates) may be non-pre-aggregated data. The analytics platform enables self-organizing interactive querying of such non-pre-aggregated data.
[0023] As indicated above, the enhanced query plan executes faster than the original query plan. This is because the enhanced query plan takes fewer CPU cycles to execute than the original query plan. In some embodiments, this is because the number of fact records received by and processed by the second operation in the enhanced query plan is less than the number of fact records received by and processed by the second operation in the original query plan.
[0024] In some embodiments, identifying the first predicate condition involves identifying a first fact scan operation as operating on a first fact table in an original query plan. Starting from the first scan operation, the original query plan is then traversed to identify a list of one or more applicable predicate conditions for the first fact scan operation, the list of applicable predicate conditions including the first predicate condition.
[0025] In some embodiments, identifying the first predicate condition includes identifying, from the original query plan: a first fact scan operation operating on a first fact table; a second fact scan operation operating on a second fact table; a join operation between the second fact table and a dimension table, wherein the first predicate condition is associated with the dimension table; and a common dimension between the first fact table and the second fact table, wherein the first predicate condition is based on an attribute from the common dimension.
[0026] In some embodiments, identifying a first predicate condition includes identifying a plurality of predicate conditions applicable to a first fact scan operation. A net benefit metric is then calculated for each of the plurality of predicate conditions, wherein the net benefit metric for a particular predicate condition in the plurality of predicate conditions is a measure of the reduction in the cost of processing a fact row from a source of fact records minus the cost of applying the particular predicate condition to the first fact scan operation. The predicate conditions in the plurality of predicate conditions are then ranked based on the net benefit metrics calculated for the plurality of predicate conditions. One or more predicate conditions are then selected to be associated with the first fact scan operation based on the ranking. In some embodiments, the predicate condition with the highest net benefit metric is selected to be associated with the first fact scan operation.
[0027] In some embodiments, identifying a first predicate condition includes identifying an applicable predicate condition for a first fact scan operation. A net benefit metric is calculated for the applicable predicate condition. Based on the net benefit metric calculated for the applicable predicate condition, it is determined that the applicable predicate condition is not feasible for association with the first fact scan operation. Another predicate condition to be associated with the first fact scan operation is then inferred from the applicable predicate condition using the functional dependency information.
[0028] The source of fact records can be of various types, including tables storing fact records, materialized views, or online analytical processing (OLAP) indexes.
[0029] In some embodiments, identifying the first predicate condition includes identifying a third operation in the original query plan, wherein the first predicate condition is associated with the third operation. The third operation may be associated with a dimension table in the original query plan.
[0030] In some embodiments, identifying the first predicate condition includes identifying a second predicate condition to be associated with the first scan operation, and converting the second predicate condition into the first predicate condition. The converting may include converting the second predicate condition into the first predicate condition using the functional dependency information. In one example, the second predicate condition specifies a value for a first dimension field, and the first predicate condition specifies a value for a second dimension field different from the first dimension field, wherein the second dimension field is a column field in a dimension table or in a source of a fact record.
[0031] In some embodiments, a first sub-plan in an original query plan may be identified, the first sub-plan including a first fact scan operation, wherein the first sub-plan includes only one or more of an aggregation, a join, a projection, a filter, or a fact scan operation. The enhanced query plan, when generated, may include the first sub-plan having a first predicate condition associated with the first scan operation.
[0032] In certain embodiments, the processing may include determining, based on the star schema, that a source of the fact record can be joined with a dimension table, and wherein the first predicate condition includes a condition related to a dimension key in the dimension table to be joined with the source of the fact record.
[0033] In some embodiments, the source of the fact record is an OLAP index, which includes a table and an index that indexes dimension values in the table. The table may include data generated by joining a fact table storing the fact record with a dimension table including dimension values, and the first predicate condition is evaluated for the dimension values in the OLAP index.
[0034] The foregoing and other features and embodiments will become more fully apparent by reference to the following description, claims and accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1A and Figure 1B is a simplified block diagram of an analytics platform according to certain embodiments.
[0036] Figure 2 Depicted are a collection of fact and dimension tables in accordance with certain embodiments.
[0037] Figure 3 Depicted are query plans according to certain embodiments.
[0038] Figure 4 A star architecture is depicted in accordance with certain embodiments.
[0039] Figure 5 Depicted are rewritten query execution plans in accordance with certain embodiments.
[0040] Figure 6 Methods for performing a semi-join operation according to certain embodiments are described.
[0041] Figure 7 An online analytical processing (OLAP) index is depicted in accordance with certain embodiments.
[0042] Fig. 8A and Figure 8B Methods for performing indexed semi-join operations according to certain embodiments are described.
[0043] Fig. 9 Methods of transforming predicate conditions based on functional dependencies according to certain embodiments are described.
[0044] Fig. 10A and Fig. 10B Described are methods for propagating predicate conditions from a first set of dimension records to a set of fact records across a second set of dimension records in accordance with certain embodiments.
[0045] Fig.11 Depicted is a schema including multiple fact tables according to certain embodiments.
[0046] Figure 12A-12C Depicted is a method for propagating predicate conditions across a set of dimension records (from dimension table DT) across a first set of fact records (fact source 1 “FS1”) to a second set of fact records (fact source 2 “FS2”) in accordance with certain embodiments.
[0047] Fig.13A is a simplified flow chart depicting a method of generating an enhanced query plan according to certain embodiments.
[0048] Fig. 13B is a simplified flow chart depicting further details related to a method of generating an enhanced query plan according to certain embodiments.
[0049] Fig.14 Depicted is a simplified diagram of a distributed system for implementing an embodiment.
[0050] Fig.15 is a simplified block diagram of a cloud-based system environment according to certain embodiments.
[0051] Fig.16 A computer system is illustrated that may be used to implement certain embodiments.
[0052] Fig.17 Another architecture according to some embodiments is depicted. DETAILED DESCRIPTION
[0053] In the following description, for the purpose of explanation, specific details are set forth in order to provide a thorough understanding of certain inventive embodiments. However, it will be apparent that various embodiments can be practiced without these specific details. The drawings and descriptions are not intended to be limiting.
[0054] The present disclosure generally relates to techniques for efficiently executing analytical queries such as interactive self-organizing database queries. For queries such as SQL self-organizing queries, the query plan generated for the query is optimized and enhanced and rewritten as an optimized or enhanced query plan. The enhanced query plan uses fewer CPU cycles than the original non-optimized query plan when executed, and therefore executes faster than the original query plan. Therefore, the query for which the enhanced query plan is generated executes faster without compromising the results obtained or the data being queried. In some embodiments, the optimized or enhanced query plan also uses fewer memory resources than the original non-optimized query plan when executed.
[0055] In some embodiments, the original query plan is optimized by identifying a set of one or more fact scan operations / operators in the original query plan and then associating a dimension context with one or more of the set of fact scan operations in the rewritten enhanced query plan. In some embodiments, the dimension context is associated with the fact scan operation by associating one or more predicate conditions (also referred to as dimension context predicate conditions) corresponding to the dimension context with the fact scan operation. The fact scan operation is an operation in the query plan that is configured to scan or read facts (also referred to as fact records or fact rows) from a source of fact records (also referred to as a fact source). The association of the predicate condition with the fact scan operation in the enhanced query plan is also referred to as the propagation of the predicate condition or dimension context to the fact scan operation or the propagation of the predicate condition or dimension context to the fact source (the fact scan operation operates on the fact source). Due to the association or propagation, the total cost of scanning / reading and / or processing the fact record in the enhanced query plan is much lower than that of the original query plan. Therefore, the enhanced query plan uses fewer CPU cycles than the original non-optimized query plan when executing, and therefore executes faster than the original query plan.
[0056] In some embodiments, the process of optimizing a query plan may include identifying which one or more fact scan operations in the query plan are candidates for predicate condition propagation, identifying one or more predicate conditions to be associated with each candidate fact scan operation, and then rewriting the query plan with the association. The query plan for executing the query with the association. Various different techniques disclosed herein may be used to perform this process.
[0057] Various different techniques can be used to identify the predicate conditions to be associated with the fact scanning operation. For example, the predicate conditions from one part of the original query plan can be propagated to the fact scanning operation in another part of the query plan in the rewritten enhanced query plan. As an example, the dimension predicate conditions applied to the dimension table in one part of the query plan can be propagated and associated with the fact scanning operation in another part of the query plan. In some other cases, instead of associating a specific predicate condition with the fact scanning operation, a new predicate condition (also referred to as the conversion or mapping of a specific predicate condition or the original predicate condition to the new predicate condition) is inferred from the specific predicate condition or the original predicate condition in the query plan, and the new predicate condition is associated with the fact scanning operation instead of the specific predicate condition. The new predicate condition makes the cost (e.g., execution time) of executing the fact scanning operation with the new predicate condition less than the cost of executing the fact scanning operation with the specific predicate condition or the original predicate condition. In some cases, instead of scanning the fact records in the fact table referenced in the query, other physical fact structures (fact sources) (such as OLAP indexes, pre-aggregated materialized views) can be used to perform scanning.
[0058] As indicated above, the enhanced query plan uses fewer CPU cycles when executed than the original non-optimized query plan, and therefore executes faster than the original query plan. There are a variety of ways to achieve this. In some cases, due to the association of predicate conditions with fact scan operations in the query plan, the number of fact records processed by the rewritten query plan is reduced compared to the original query plan. For example, as a result of the association of predicate conditions with fact scan operations, only fact records that satisfy the predicate conditions are provided from the fact scan operation to the next downstream operation in the query plan. This reduces the number of fact records provided to downstream operations (e.g., join operations between fact tables and dimension tables) in the enhanced query plan and that must be processed by downstream operations. This reduces the computational overhead associated with executing downstream operations in the enhanced query plan. This filtering of fact records based on predicate conditions reduces unnecessary and repeated processing of fact records by the query plan. The reduction in the number of fact records processed by the query plan translates into faster execution times for the query plan and the query itself for which the query plan is generated. The reduction in the number of fact records processed by the query plan can also translate into fewer memory resources for executing the rewritten query plan. As described above, in some embodiments, a new predicate condition inferred or converted from a specific predicate condition can be associated with a fact scan operation rather than a specific predicate condition. The new predicate condition makes the cost (e.g., execution time) of executing a fact scan operation with the new predicate condition less than the cost of executing a fact scan operation with a specific predicate condition. For example, a fact scan operation associated with a specific predicate condition may take 2 seconds to execute, while the same fact scan operation associated with the new predicate condition may only take 1 second to execute. The inference or conversion of the predicate condition enables the enhanced query plan to execute faster than an unoptimized query plan. In addition, in some embodiments, faster execution time is achieved by performing a fact scan on an available alternative fact representation (such as an OLAP index) in such a manner so as to fully utilize the scanning capabilities of the fact representation. For example, conversion to an OLAP index scan of certain predicates "P" allows the combination to fully utilize fast predicate evaluation and skip the scan of the OLAP index, thereby resulting in a reduction in the magnitude of fact scan processing in some cases.
[0059] From a performance perspective, the enhanced query plan can execute faster and potentially use fewer resources than the unenhanced query plan. A large number of queries executed based on the teachings disclosed herein execute 10 times, 25 times, or even 100 times or even higher orders of magnitude faster than queries executed with unenhanced query plans. This is because fact tables are several orders of magnitude larger than dimension tables, so reducing the scan costs associated with processing fact records brings huge performance improvements. For example, in one case, the query execution time of a self-organizing query was reduced from 206 seconds to 16 seconds. Queries can be executed on large data sets (e.g., TB-level data sets) in seconds.
[0060] Various different pieces of information can be used to facilitate the query plan optimization described herein. In some embodiments, the query plan generated for a database query can be optimized and enhanced based on the following conditions: the structure of the query, the structure of the query plan generated for the query, the schema information related to the database being queried, and the semantic information available to the query plan optimizer and / or enhancer. For example, business semantics or business intelligence (BI) semantic information can be used to rewrite the query plan. Semantic information can include business data with rich value and structural semantics based on real-world processing, organizational structure, etc. Semantic information can include information related to business models, such as business hierarchies and functional dependencies in data. For example, dependency information can include information describing the relationship (e.g., hierarchical or non-hierarchical) between different fields (e.g., columns) of database data. For example, dependency metadata can include information describing the hierarchical relationship between the value of the "city" column and the value of the "state" column (e.g., San Francisco is a city in California). Examples of hierarchies include time period hierarchies (e.g., day, week, month, quarter, year, etc.), geographic hierarchies (e.g., city, state, country / region), etc. Semantic information can include data cube model semantic information. In some embodiments, metadata used for query plan enhancement can include information about how the data being analyzed is physically stored, as well as logical information identifying relationships between the data. In some embodiments, semantic information can be determined based on analyzing information about the structure and schema of the database storing the data being analyzed, without any user input. Inferences drawn from such analysis can be used to rewrite the query plan to generate an optimized and enhanced query plan.
[0061] For example, a query plan generated for a query can be analyzed to identify fact scan operations on fact sources. Semantic information (e.g., join operations of fact and dimension context tables, functional dependencies between database columns, physical materialization of facts) can then be used to proactively identify and drive dimensional context conditions on fact scan operations in a rewritten, optimized query plan. This results in a significant reduction in the cost (e.g., time) involved in processing fact records in the rewritten query plan. As a result, the rewritten query plan executes faster (e.g., uses fewer CPU cycles) and, in many cases, can use fewer memory resources than an unoptimized query plan. This translates into the query for which the query plan was generated executing faster and potentially using fewer memory resources.
[0062] Figure 1A is a simplified block diagram of an analytics platform or infrastructure 100 incorporating an example embodiment. Analytics platform 100 may include multiple systems communicatively coupled to each other via one or more communication networks. Figure 1AThe system in includes a processing system 150 and a storage system 106 that are communicatively coupled to each other via one or more communication networks. The communication network can facilitate Figure 1A The communication network may be of various types and may include one or more communication networks. Examples of such communication networks include, but are not limited to, the Internet, a wide area network (WAN), a local area network (LAN), an Ethernet, a public or private network, a wired network, a wireless network, and the like, and combinations thereof. Different communication protocols may be used to facilitate communication, including wired and wireless protocols, such as the IEEE 802.XX protocol suite, TCP / IP, IPX, SAN, and other protocols. The communication network may include facilitating Figure 1A Any infrastructure for communication between the various systems depicted.
[0063] Figure 1A The analysis platform 100 depicted in the foregoing is merely an example and is not intended to unduly limit the scope of the claimed embodiments. The platform can be elastically scaled out as needed to accommodate changes in the size of the data being queried and changes in the workload (e.g., the number of queries being executed in parallel or otherwise). Those of ordinary skill in the art will recognize many possible variations, substitutions, and modifications. For example, in some embodiments, the analysis platform 100 may have more than Figure 1A More or fewer systems or components than those shown in the drawings may be combined with two or more systems, or may have different system configurations or arrangements. Figure 1A The infrastructure depicted in and described herein can be implemented in a variety of different environments including standalone or clustered embodiments as an on-premises or cloud environment (which can be various types of clouds including private, public, and hybrid cloud environments), an on-premises environment, a hybrid environment, etc.
[0064] In some embodiments, the data to be analyzed or queried may be stored by the storage system 106. The data stored in the storage system 106 may come from one or more data sources. Data may be organized and stored in various forms (such as object storage, block storage, just a pile of disks (jbod), such as in disks on computing nodes, etc., and combinations thereof). The storage system 106 may include volatile memory and / or non-volatile memory for storing data. For example, the storage system 106 may include a database storing business data to be analyzed. Business data is generally multidimensional and semantically rich. The storage system 106 represents the storage layer of the analysis platform 100, which includes physical storage components (e.g., rotating hard disks, SSDs, memory caches, etc.) that store data persistently, and also includes software that provides countless data structures for storing relational / spatial / graph data in a manner that best serves specific query workloads. The data in the storage system 106 does not have to be all located in one location, but can be stored in a distributed manner. Data can be organized and stored in various storage / computing environments, such as data lakes, data warehouses, Hadoop clusters, etc.
[0065] The memory resources of the storage system 106 and the processing system 150 may include system memory and non-volatile memory. The system memory may provide memory resources for one or more processors. The system memory is typically in the form of a volatile random access memory (RAM) (e.g., dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM)). Information related to the operating system and the applications or processes executed by one or more processors may be stored in the system memory. For example, during runtime, the operating system / kernel may be loaded into the system memory. In addition, during runtime, data related to one or more applications executed by the server computer may be loaded into the system memory. For example, an application executed by a server computer may be loaded into the system memory and executed by one or more processors. The server computer may be able to execute multiple applications in parallel.
[0066] Non-volatile memory can be used to store data that is to be stored persistently. Non-volatile memory can come in different forms, such as hard disk, floppy disk, flash memory, solid state drive or disk (SSD), USB flash drive, memory card, memory stick, cassette tape, zip box, computer hard drive, CD, DVD, network attached storage device (NAS), memory storage device provided via storage area network (SAN), etc. In some cases, when an application is deployed to a server computer or installed on a server computer, information related to the application can be stored in non-volatile memory.
[0067] In some embodiments, the data in the storage system 106 may be stored in a relational database in tables that are logically structured as one or more star schemas, or in a system with a dedicated storage structure such as a multidimensional array (also commonly referred to as a multidimensional cube). A star schema includes a central fact table that references any number of dimension tables. Each fact table stores facts or metrics in the form of fact records. A fact table may be linked to a dimension table that associates a fact with its context. A dimension table stores contextual information describing the metric data stored in a fact table row. Since a fact table is typically associated with many dimensions, the structure graphically looks like a star, hence its name. There is generally an order of magnitude difference between the number of facts and the number of unique dimension values, with facts far outnumbering dimensions in number. For example, a business may have hundreds of millions of sales fact records, but only a few (e.g., a few thousand) dimensions (such as stores, states of sales, etc.). Therefore, the size of the fact table is generally very large and is an order of magnitude larger than the dimension table.
[0068] Here, the term "star schema" is used in its most general form to capture the logical relationship between a fact row and many dimension table rows; therefore, variants such as snowflake schema are also implied and included under the term "star schema" used in this disclosure. Snowflake schema differs from star schema in that the relationship between fact rows and dimensions can be indirect (requiring more than a direct association, such as a sales fact row linked to a customer row, and a customer row linked to a customer address row).
[0069] Another way to view analytical data is as an n-dimensional cube. Typical analysis looks at some arbitrary subspace (also called a slice) of this large multidimensional space. The focus of any particular analysis can span multiple dimensions and activities, can have multiple steps, and involve arbitrary links between entities and their activities. In the relational world, a data cube can be modeled as a star schema.
[0070] In a relational database, an event or transaction (e.g., the sale of a product) can be captured in a large fact table joined to many dimension tables. An analytical scenario can include many such star schemas, where the fact tables have a common set of dimensions. Figure 4 An example star schema 400 corresponding to data related to transactions related to store returns is depicted. The schema 400 captures store return transactions and describes a one-to-many relationship between fact records and dimension records. Figure 4, Store_Returns is a fact table (shown with emphasized boundaries) that stores fact records containing metric information related to store return transactions, while the other tables (Date, Store, Item, Customer, Customer_Address) are dimension tables that store context information for the fact records. Each return transaction is recorded along with the associated context, including information about the return store (including store identifier, city, and state), information about the return customer, and time information (month, day, year) of the transaction. The star schema 400 indicates that store returns are dimensioned by Date, Customer, Item, Store, and Customer_Address dimension records, and can be joined with the Store_Returns fact record.
[0071] Figure 2 Depicted is an example database data 200 that includes a fact table 202 and a plurality of dimension tables 204-208, each dimension table having and Figure 4 4. Fact table 202 is related to the star schema 400 depicted in FIG. Fact table 202 includes foreign key columns 210, 212, and 214, which can be joined with primary key columns 218 in table 204, 226 in table 206, and 230 in table 208, respectively, to add columns rather than rows to fact table 202. Although Figure 2 Database data 200 is depicted as tables, but it should be appreciated that database data 200 may be represented as indexes, materialized views, and / or any other set of tuples.
[0072] exist Figure 2 In the example of FIG. 2 , fact table 202 also includes a fact record storing a fact metric column 216 (return_amt). Foreign key columns 210, 212, and 214 enable fact metric column 216 to be analyzed based on one or more dimension columns (e.g., dimension columns 220, 222, 224, 228, 232, and 234). In general, as Figure 2 As depicted in , there are usually many more fact records than dimension records. For example, there can be millions of fact records, while there can be thousands of dimension records.
[0073] Processing system 150 may be configured to enable analysis of data stored by storage system 106. Analysis may be performed using analytical queries such as SQL queries. Processing system 150 may be configured to receive one or more queries 130. In some use cases, query 130 may be input by a user using an interface provided by processing system 150. In other cases, query 130 may be received by processing system 150 from other applications, systems, or devices. In some use cases, processing system 150 may generate its own queries.
[0074] In some embodiments, for a query, the processing system 150 is configured to generate an enhanced query plan for the query. Various different techniques described in more detail below can be used to generate the enhanced query plan. The processing system 150 can then execute the enhanced query plan against the data stored by the storage system 106 and generate a result set. The processing system 150 can then output the result set as a response to the received query.
[0075] As in Figure 1A As in the embodiment depicted in , an OLAP index 126 (eg, an OLAP index) may be provided to very quickly scan / read facts from a fact source in a relational database. In some embodiments, the processing system 150 may be configured to generate one or more OLAP indexes 126.
[0076] In certain embodiments, Figure 1A The analysis platform 100 depicted in the Figure 1 can be run on a cluster of one or more computers. For example, the analysis platform 100 can be implemented using a distributed computing framework provided by Apache Spark or Apache Hadoop. Each computer may include one or more processors (or central processing units (CPUs)), memory, storage devices, network interfaces, I / O devices, etc. Fig.16 An example of such a computer is depicted in and described below. The one or more processors may include a single core or multi-core processor. Examples of the one or more processors may include, but are not limited to, a general purpose microprocessor such as a A general-purpose microprocessor provided by Freescale Semiconductor, etc., which operates under the control of software stored in an associated memory. The software components of the analysis platform 100 can run as applications on top of an operating system. The applications executed by the server computer can be executed by one or more processors.
[0077] As a result of the enhanced query plans generated by the processing system 150, queries for which the enhanced query plans are generated can be executed more quickly. This translates into faster response times for queries. These fast response times enable interactive analysis of multidimensional data stored in the storage system 106 without compromising the results or the data being analyzed. For example, interactive queries can be run against data associated with machine learning techniques, clickstreams, and event / time series, and more generally against any data set that can grow rapidly in size and complexity.
[0078] In addition, the query is run directly on the data stored in the database in the storage system 106, rather than on any pre-aggregated data. Therefore, the query can be run on a large data set in situ without creating pre-aggregated data or extracts. Instead, the query can be executed on the actual original unprocessed data itself. In certain embodiments, as described herein, by using predicate conditions and using in-memory OLAP indexes with a fully distributed computing engine, the query can be made faster. This enables the analysis platform 100 to facilitate self-organizing queries, which cannot be run on pre-aggregated data. Self-organizing queries are unpredefined queries. Self-organizing queries are generally created to analyze information when the information becomes available. The analysis platform 100 described herein provides the ability to run interactive self-organizing queries on very large (terabytes and above) multidimensional data (e.g., data stored in a data lake) in a very cost-effective manner; in the past, it was very expensive to run such interactive self-organizing queries on very large (terabytes and above) multidimensional data using conventional technology, and it was not scalable.
[0079] Additionally, implementations of the analytics platform using Apache Spark inherently enable query execution at scale, providing an elastic environment where computing and storage (e.g., new data available for analysis) can scale independently.
[0080] In the analysis platform 100, the data to be queried is stored in a central location, from which the data can be analyzed using one or more different analysis tools. No unique preparation of the data by different tools is required. Different users can access the data with the tools of their choice, including Zeppelin or Jupyter notebooks running Python or R, BI tools such as Tableau, etc.
[0081] For large amounts of multidimensional data, it is difficult to perform interactive queries on a large scale. This is because interactive queries require fast response times. For large amounts of multidimensional data, query performance decreases as the amount of data (e.g., terabytes of data) increases and the number of users trying to access the data set increases simultaneously. In addition, joins between fact tables and dimension tables can create additional performance bottlenecks. In the past, pre-aggregation techniques have been used to alleviate this problem. For example, OLAP cubes, extracts, and materialized pre-aggregated tables have been used to facilitate analysis of multidimensional data.
[0082] Pre-aggregated data (also called aggregated data or aggregates) is data that has been generated from some underlying data (called raw data or unprocessed data) using one or more pre-aggregation (or aggregation) techniques. Data aggregation or pre-aggregation techniques include any processing that represents data in summarized form. Pre-aggregated data can include pre-computed or summarized data and can be stored in pre-aggregated tables, extracts, OLAP cubes, etc. When facts are aggregated, it is done by eliminating dimensions or by associating facts with accumulated dimensions. Therefore, pre-aggregated data does not include all the details from the raw or unprocessed data from which the pre-aggregated data was generated.
[0083] However, pre-aggregation has several disadvantages. All pre-aggregation techniques result in a loss of granularity. Since only certain predetermined pre-aggregations are provided, pre-aggregation results in a loss of details of the data. For example, a raw or unprocessed data set may record sales information on a daily basis. If a monthly-based pre-aggregation is then performed based on this data, the daily or daily information is lost. It is impractical to build a pre-aggregated data set or multidimensional cube for all combinations of all dimensions and measures. Therefore, pre-aggregation limits the ability to perform self-organizing queries because the key information (e.g., daily information) behind the higher-level pre-aggregation summary (e.g., monthly information) is not available. Queries are run against pre-aggregated data, not against the raw or unprocessed data from which the pre-aggregation was generated. Therefore, aggregation changes the granularity at which analysis can be performed. The granularity of a fact refers to the lowest level at which an event is recorded. For example, the sale of a product may be recorded with a sale time and a timestamp. The aggregation of sales may span multiple levels, such as revenue by channel and product or revenue by category, product, store, state, etc. The ability to browse data at multiple granularities and dimensions is important. The correct granularity for pre-aggregation is difficult to predict in advance. Therefore, pre-aggregated cubes and materialized summary tables break down when it comes to big data analytics.
[0084] The analytics platform 100 avoids various drawbacks associated with pre-aggregation based analytics techniques.The analytics platform 100 provides a framework for performing data analytics of multi-dimensional data at different granularities and dimensions at scale and speed.
[0085] For the purposes of this application, the term "non-preaggregated data" is used to refer to data that does not include preaggregated or precomputed data. In certain embodiments, the analysis platform 100 enables queries to be performed on non-preaggregated data stored in the storage system 106. This enables self-organized queries to be performed on non-preaggregated data stored in the storage system 106. In addition, due to the query plan enhancements provided by the processing system 150, the response time of the query is greatly reduced, thereby enabling interactive queries to be run. The analysis platform 100 described herein provides the ability to run interactive self-organizing queries on very large (terabytes and above) multidimensional data (e.g., data stored in a data lake) in a very cost-effective manner; in the past, running such interactive self-organizing queries on very large (terabytes and above) multidimensional data using conventional techniques was very costly and unscalable.
[0086] Figure 1B is a diagram showing a method according to some embodiments Figure 1A A simplified block diagram of a more detailed view of the analysis platform 100 depicted in FIG. Figure 1B The analysis platform 100 depicted in FIG. 1 is merely an example and is not intended to be limiting. One of ordinary skill in the art will recognize many possible variations, substitutions, and modifications. For example, in some embodiments, the data analysis platform 100 may have more than Figure 1B More or fewer components may be shown, two or more components may be combined, or different component configurations or arrangements may be provided. Figure 1B The infrastructure depicted in and described herein can be implemented in a variety of different environments, including stand-alone embodiments, cloud environments (which can be various types of clouds, including private, public, and hybrid cloud environments), on-premises environments, hybrid environments, etc.
[0087] exist Figure 1B In the example, Figure 1A The processing system 150 depicted in the diagram includes a data analysis system 102 and a database management system (DBMS) 104, which may be communicatively coupled to each other and also coupled to a storage system 106. In some embodiments, the data analysis system 102, DBMS 104, and storage system 106 may represent different logical layers of an OLAP database system. In some embodiments, the data analysis system 102, DBMS 104, and storage system 106 may be physically separate systems. In other embodiments, they may be combined into one system. DBMS 104 and data analysis system 102 together provide a powerful analysis platform that combines business intelligence techniques with the capabilities of Apache Spark.
[0088] The storage system 106 can store the data to be analyzed in fact and dimension tables. Figure 1BAs shown in , there may be multiple sources 108 of fact records, including fact tables 124, OLAP indexes 126, materialized views 128, and / or other sources. Fact tables 124 may include one or more rows and one or more columns, where each row may represent a fact record and a column may represent a field of the record. In some embodiments, storage system 106 may be distributed and / or virtualized within analysis platform 100.
[0089] The storage system 106 may also store context associated with the fact record as one or more dimension tables 110 storing one or more dimension records. Typically, the fact record stores values of metrics that can be analyzed based on the dimension records in the dimension table 110. For example, the fact record may include sales, and the dimension record may include date values based on which the sales may be aggregated, filtered, or otherwise analyzed. The fact record sources 108 (e.g., fact tables, OLAP indexes, and materialized views) and the dimension tables 110 and records are discussed in more detail below.
[0090] The storage system may store metadata 109. The metadata 109 may include information about relational artifacts such as tables, columns, views, and the like.
[0091] exist Figure 1B In the example of , the storage system 106 may additionally store other pieces of information associated with the database management system, such as schema information 116 and statistical information 112. The schema information 116 may identify the structure of tables, indexes, and other artifacts associated with the database. For example, for a star schema, the schema information 116 may include information describing the relationship between fact records and dimension records. For example, the schema information 116 may be used to determine that sales data can be queried based on a time dimension and a geographic region dimension. In some embodiments, the schema information 116 may be defined by a domain expert or analyst. The schema information 116 may define a star schema, such as Figure 4 and Fig. 9 The pattern depicted in .
[0092] The statistical information 112 may include information about fact records or dimension records, as well as other information related to query plans and performance-related attributes of the database management system 104. For example, the statistical data 112 may include table-level statistics (e.g., the number of rows in a table, the number of data blocks used for a table, or the average row length in a table) and / or column-level statistics (e.g., the number of distinct values in a column or the minimum / maximum values found in a column).
[0093] The DBMS 104 may be configured (e.g., including software that, when executed by one or more processors, enables functionality) to provide functionality that enables the creation of one or more databases, the addition of data to a database, the updating and / or deletion of data stored in a database, and other functionality associated with managing databases and stored data. The DBMS 104 may also be configured to receive one or more queries 130 to analyze data stored in the storage system 106, perform analysis corresponding to the query, and output query results 132. The query 130 may be in different forms and languages, such as structured query language (SQL).
[0094] Query 130 may be received from one or more sources, such as a user of DBMS 104, from another system, etc. For example, in Figure 1B In the embodiment depicted in , in some cases, a query may be received from a data analysis system (DAS) 102. DAS 102 may be configured to perform analysis on data stored in storage system 106. DAS 102 may include software configured to generate analysis queries for DBMS 104 to execute on data stored by storage system 106. For example, if storage system 106 stores sales records, DAS 102 may generate a query for analyzing sales records (e.g., a query for analyzing sales trends, a query for analyzing advertising campaigns, and other queries for gaining insights about business activities or extracting useful patterns) and send the query to DBMS 104. In some embodiments, DAS 102 may use information stored in storage system 106 (e.g., schema information 116) to generate the analysis query. For example, star schema 116 may be used to determine that sales data may be queried according to a time dimension and a geographic region dimension. Results retrieved by DBMS 104 corresponding to the query received from DAS 102 may be provided by DBMS 104 to DAS 102.
[0095] like Figure 1B As depicted in , DBMS 104 may provide an interface 122 for receiving a query 130. Parser 120 may be configured to perform syntax and semantic analysis on the received query. For example, for an SQL query, parser 120 may be configured to check the SQL statements in the query for correct syntax and to check whether the database objects and other object properties referenced in the query are correct.
[0096] After the query has passed the syntax and semantic checks performed by the parser 120, the optimizer 114 can be configured to determine a query plan to efficiently execute the query. The optimizer 114 can output a query plan for optimally executing the query. In some embodiments, the execution plan includes a series or pipeline of operations / operators to be executed. The execution plan can be represented by a rooted tree or graph, wherein the nodes of the tree or graph represent individual operations / operators. The query plan graph is generally executed starting from the leaves of the graph and moving toward the root. The leaves of the query plan usually represent fact scan operations that scan fact records or rows or read fact records or rows from a fact source (e.g., a fact table). The output of any relational operator in the query plan is a calculated data set. The calculated data set (e.g., a set of rows or records) returned by the operation in the query plan is provided as the input of the next operation (also referred to as a parent operation or downstream operation) in the query plan pipeline and is consumed by it. In the last operation in the query plan pipeline (the root of the query plan graph), the fact row is returned as the result of the SQL query. Thus, the rows returned by a particular operation in a query plan become the input rows for the next operation in the query plan pipeline (the parent or downstream operation of the particular operation). The set of rows returned by an operation is sometimes called a row set, and the nodes that generate row sets in a query plan are called row sources. Thus, a query plan represents a flow of row sources from one operation to another. Each operation of a query plan retrieves rows from the database or accepts rows from one or more other child operations or upstream operations (or row sources).
[0097] In some embodiments, the optimizer 114 may perform cost-based optimization to generate a query plan. In some embodiments, the optimizer 114 may strive to generate a query plan for a query that is capable of executing the query (maximum throughput) using the least amount of resources, including I / O, CPU resources, and memory resources. The optimizer 114 may use various pieces of information (such as information about the fact source 108, architecture information 116, hints, and statistics 112) to generate a query plan. In some embodiments, the optimizer 114 may generate a set of potential plans and estimate the cost of each plan, where the cost of the plan is an estimate proportional to the expected resource usage required to execute the plan. The cost of the plan may be based on the access path, the operations in the plan (e.g., join operations). The access path is the way to retrieve data from the database. The rows or records in the fact table may be retrieved by a full table scan (e.g., the scan reads all rows / records in the fact table and filters out rows / records that do not meet the selection criteria), using an index (e.g., by traversing the index, using the indexed column value to retrieve the row), using a materialized view, or a rowid scan. The optimizer 114 may then compare the costs of the plans and select the plan with the lowest cost.
[0098] In some embodiments, enhancer 103 is configured to further enhance / optimize the query plan selected by optimizer 114 and generate an enhanced optimized query plan. The enhanced query plan generated by enhancer 103 is better than the query plan generated by optimizer 114 because it executes faster than the unenhanced query plan and, in many cases, can use fewer resources than the unenhanced query plan.
[0099] The optimized enhanced query plan generated by the enhancer 103 may then be provided to the executor subsystem 105, which is configured to execute the query plan against the data stored in the storage system 106. The results obtained by the executor 105 executing the query plan received from the enhancer 103 may then be returned by the DBMS 104 as a result response to the input query. The executors 105 represent the execution layer of the runtime processing that processes the query based on the enhanced query plan provided to them. They may contain operators / operation implementations (e.g., SQL, graph, spatial, etc.) that operate on and transform the data tuple stream in a specific way.
[0100] The enhancer 103 may use various techniques for generating enhanced query plans from query plans generated by the optimizer 114. In certain embodiments, the enhancer 103 may use metadata / semantic information 117 stored by the DAS 102 to further optimize and enhance the query plans generated by the optimizer 114. For example, based on semantic information available for a star schema (e.g., from a star schema semantic model), the enhancer 103 may be configured to infer dimensional context / predicate conditions applicable during scan operations on sources of fact records in the query plan generated by the optimizer 114. The enhancer 103 may use this inferred information to further optimize the query plan generated by the optimizer 114. In certain embodiments, the enhancer 103 performs a method of converting the inferred dimensional context / predicates into applicable predicate conditions for scan operations on sources of fact records using field / column functional dependencies defined in semantic data (e.g., in a star schema or semantic model of a cube). In some cases, the enhancer 103 may apply the inferred dimensional context / predicate conditions to an index source (eg, an OLAP index fact source) of fact records that fully exploits the data structures within the index.
[0101] In general, for the purposes of this application, the term "fact source" is used to refer to the source of fact records. A fact source can be any relationship that is a source of facts (e.g., fact records). A fact source can be an original fact table or some other materialization of facts. Common materialization techniques include pre-aggregated views and cube representations, such as OLAP indexes. For example, a fact source can be a fact table (e.g., a fact table in a relational database based on a star schema), an index (e.g., an OLAP index on a star schema or cube, such as a pre-join index that provides the ability to quickly access facts in any sub-region of a multidimensional space), or a materialized view (e.g., a materialized view at a certain aggregation level for a star schema). A fact source represents any data set or table that is a source of fact records (e.g., business facts). Facts can be at a specific dimensional granularity.
[0102] As indicated above, the enhancer 103 can use metadata / semantic information 117 to infer dimension context / predicate conditions. The semantic information 117 can include business intelligence information. For example, the semantic information 117 can include business data with rich value and structural semantics based on real-world processes, organizational structures, cube information, etc. The semantic information can include information related to the business model, such as business hierarchies and functional dependencies in the data. The enhancer 103 uses this hierarchy and dependency information to generate an enhanced query plan, thereby speeding up the execution of the query. For example, dependency metadata information can include information describing the relationship (e.g., hierarchical or non-hierarchical) between different fields (e.g., columns) of database data. For example, dependency metadata can include information describing the hierarchical relationship between the value of the "city" field column and the value of the "state" field column (e.g., San Francisco is a city in California). The enhancer 103 can use the dependency metadata and the granularity of the query sub-plan results to infer the applicability of the predicate conditions for the fact source scan within the query sub-plan. In some embodiments, the semantic information can be determined by analyzing information about the structure and architecture of the database storing the data being analyzed by the query without any user input.
[0103] The semantic information used by the enhancer 103 to enhance the query plan can be obtained or determined from multiple sources. As an example, the semantic information can be obtained from a business intelligence (BI) data source. For example, Figure 1BAs shown in the embodiment depicted in , DAS 102 may include or may access various data sources storing BI information, wherein the BI information includes semantic information 117. In other embodiments, the semantic information may be the structure of the data being analyzed and the data structure used to store the data. For example, for a database storing the data being analyzed, the schema information 116 of the database may be used to determine the semantic information. Enhancer 103 may use the schema information 116 to infer the application of predicate conditions and further infer predicate conditions based on the predicates in the input query.
[0104] Although in Figure 1B 104. The optimizer 114 and enhancer 103 are shown as separate subsystems in FIG. 104, but this is not intended to be limiting. In an alternative embodiment, enhancer 103 may be part of optimizer 114. In such an embodiment, optimizer 114 selects a query plan and then enhances it using the techniques described in the present disclosure. In some embodiments, enhancer 103 may be part of DAS 102 rather than part of DBMS 104. In this case, DBMS 104 may cooperate with DAS 102 to generate the enhanced query plan. In some embodiments, parser 120, optimizer 114, enhancer 103, and executor 105 may be collectively referred to as the query engine of DBMS 104.
[0105] As indicated above, analytical queries such as SQL queries can then be used to analyze stored data such as Figure 2 . A typical query may involve one or more fact sources combined with dimension tables and with each other. In certain embodiments, as disclosed herein, the enhancer 103 analyzes the query plan generated by the optimizer for the query from the perspective of each fact source scan and attempts to infer dimensional contexts (e.g., dimensional filters) that can be applied to fact rows so that the number of fact rows processed is greatly reduced and / or the overall cost of performing scan operations is reduced. In the case of a star join (a join that represents a combination of a fact source and its dimensional context), the following can be used to identify the individual dimensional contexts to be inferred and applied to the fact sources:
[0106] • Fact representations joined along the edges of a star architecture can exploit lossless decomposition of combinations (thus no new facts are introduced).
[0107] ● Functional dependencies in the semantic model of the star schema can be exploited.
[0108] ● In the case of an OLAP indexed fact source, a rewrite can be performed.
[0109] Since a fact source can pre-join facts with its dimensions, joins in a star schema are classified as fact source joins in the context of a fact source. A star schema join is a join that is traversed when forming a fact source.
[0110] An analytical query may be received to be executed against database data 200 to analyze the data stored in database 200. An example of such a query is shown below as Query A:
[0111] Query A
[0112]
[0113]
[0114] The natural language equivalent of Query A is "Identify 'problematic' customer-store relationships, where 'problematic' is defined as those customers whose returns exceed the store's average by 20%. The question is about the relationship of customers to the stores they visit, not about overall customer behavior. Additionally, an analysis is being conducted for the state of Tennessee.
[0115] Upon receiving a query such as Query A shown above, the database management system is configured to parse the query and then generate a query plan for the query. The query plan is then executed by the database management system against stored data records to obtain results related to the query. Figure 3 is a logical tree or graph representation of a query plan 300 that may be generated for query A. Query plan 300 may represent a query plan generated and selected by optimizer 114. Query plan 300 represents a logical flow diagram of how to operate on data in relational tables. As previously described, a query plan represents the flow of row sources from one operation to another in a query plan pipeline. Each operation of a query plan retrieves rows from a database or accepts rows from one or more other operations (or row sources).
[0116] Query plan 300 includes four leaf nodes representing fact or dimension tables. Non-leaf nodes in the query plan represent various relational operators. Figure 3 Examples shown in include filter operators, join operators, aggregation operators, and projection operators. A non-leaf node takes the row output of its child nodes as input, and provides the row output of the non-leaf node as input to the parent node of the non-leaf node, or if the non-leaf node is a root node, then the row or record output by the root node is provided as the result of the query execution. For example, in Figure 3 , node 310 takes as input the rows output by nodes 308 and 304, node 308 takes as input the rows output by node 306, and node 304 takes as input the rows or records returned by a scan of the storage table.
[0117] In query plan 300, the left aggregate subplan 302 involves calculating the return amount at the Customer and Store granularity, while the right aggregate subplan 312 calculates the return amount at the Store granularity. They are then joined to extract information about Customer, Store combinations whose return amounts exceed the corresponding store average by 20%. Thereafter, these rows are filtered on the store's state being Tennessee.
[0118] Queries generally involve multiple layers, some of which are building block layers that compute values based on raw facts. For example, an analytical query can be viewed as a layer of multidimensional computations combined through operations such as joins, unions, sorts, and getting the top / bottom n of a set. Even the relatively simple question posed by query A involves performing multiple aggregate-joins on the store returns star schema, as shown in query plan 300. Each aggregate-join involves scanning a very large fact table and joining it with one or more dimension tables, most of which are small relative to the fact table.
[0119] Figure 3 The query plan 300 depicted in FIG. 1 includes a sub-plan 302 that corresponds to the sub-query in rows 2-8 of query A. Figure 3 In the example of , sub-plan 302 corresponds to a sub-query, but it should be appreciated that a query sub-plan is not limited to a sub-query. More specifically, a query sub-plan may correspond to any portion of a database query.
[0120] Subplan 302 includes a filter operation and a join operation for evaluating the predicate in line 7 of query A. According to plan 300, the predicate condition "year=2000" will be evaluated for the "Date" dimension records, thereby filtering them. Thereafter, the predicate condition "sr.date_key=d.date_key" will be evaluated by joining the "Store_Returns" fact record with the filtered "Date" dimension record. However, performing a join operation may be computationally intensive because it typically involves processing a large number (e.g., millions) of fact records.
[0121] In a separate branch of query plan 300 that is not connected to sub-plan 302, plan 300 also includes a filter operation 304 (filtering on state="TN") corresponding to row 16 of query A. According to plan 300, filter operation 304 will be executed separately from the operations of sub-plan 302. Thereafter, after passing through nodes 306 and 308, the filtered "Store" dimension records will be joined with some results of executing the operations in sub-plan 302.
[0122] Plan 300 involves two fact scans of the fact table Store_Returns. However, the context of the entire query is the state of Tennessee and the year 2000. However, in plan 300, sub-plan 302, which includes a scan of the fact source Store_Returns, does not restrict the records to only those where the state is Tennessee. Therefore, non-Tennessee state records are also provided for processing the join operation in sub-plan 302 and from sub-plan 302 to join operation 306. Therefore, these fact records (i.e., all state store returns in the year 2000) will be unnecessarily carried forward to operations 306, 308, and 310 because at 310, those fact records that are not in TN will not be joined and filtered out. Carrying these unnecessary records through 306, 308, and 310 is wasteful in terms of resources required to execute query plan 300 because of the number of sub-records carried forward in the query plan, and increases the time required to execute query plan 300 (i.e., it takes more time to execute the query). This results in a large waste of computing resources and increases execution time.
[0123] In some embodiments, the enhancer 103 is configured to infer TN filter conditions from a portion of the query plan and change the query plan so that the inferred conditions are applied to another unrelated portion of the query plan, thereby reducing the number of fact records being carried through the execution of the entire query plan and / or reducing the overall cost of performing scan operations. Rewriting the query plan helps avoid unnecessary processing and carryover of fact records. The query plan 300 can be rewritten using inferences drawn from the star schema information 116 and / or the semantic metadata 117. The enhancer 103 can rewrite the query plan 300 using the star schema 116 and / or the semantic metadata 117.
[0124] For example, Figure 4 As depicted in , star schema 400 indicates that a "Store" dimension record can be joined with a "Store_Returns" fact record. Therefore, enhancer 103 can infer that the predicate condition used to filter the "Store" dimension record can also be used to filter the "Store_Returns" fact record.
[0125] Based on the inferences drawn from the star schema 116 and / or the semantic metadata 117, the enhancer 103 can rewrite and enhance the query plan 300 by propagating predicate conditions in the query plan from outside the query sub-plan in the query plan to inside the query sub-plan. Predicate conditions that are not connected to a sub-plan or sub-portion of the query plan are inserted into or associated with the sub-plan or sub-portion so that the number of fact records output from the sub-plan after the rewrite is less than the number of fact records output from the sub-plan before the rewrite, and / or reduce the overall cost of performing scan operations in the sub-plan without affecting the overall query results obtained from the query execution. In this way, as a result of the rewrite, irrelevant fact records that would have been filtered out during later operations of the original query plan will now be filtered out earlier in the query plan, thereby reducing the number of fact records that must be carried forward when executing the query plan and avoiding unnecessary subsequent processing. As indicated above, the fact records may number in the millions. Thus, reducing the number of fact records that must be carried forward in the query plan pipeline from one operation in a query plan to another operation in the query plan significantly improves overall query execution (i.e., makes execution faster) and reduces the waste of a significant amount of computing resources (e.g., I / O resources, processing (e.g., CPU) resources, and memory resources).
[0126] Figure 5 is a logical tree or graph representation of an enhanced query plan 500 that may be generated by enhancer 103 for performing a rewrite of query A according to some embodiments. Plan 500 represents Figure 3 500 includes sub-plan 502, which corresponds to the sub-query in rows 2-8 of query A. Figure 5 middle, Figure 3 Subplan 302 in query plan 300 has been rewritten as subplan 502. Compared to subplan 302, the rewritten subplan 502 not only has the "year=2000" condition, but now also has the additional condition "state=TN"). In this way, the "state=TN" predicate condition from operation 304 in query plan 300 has been propagated as an additional condition (in addition to "year=2000") to the filter operation in subplan 502. This rewritten filter operation 504 with these two conditions is applied to the fact records scanned from the "Store_Returns" fact table. Therefore, by changing the filter condition from Figure 3 The filter operation 304 in is propagated to the filter operation 504 in the sub-plan 502, and the sub-plan 302 (or more specifically, the filter operation 304) has been rewritten by the enhancer 103 as the sub-plan 502.
[0127] In a similar way, in Figure 5 middle, Figure 3 Subplan 312 in query plan 300 has been rewritten as subplan 512. Compared to subplan 312, the rewritten subplan 512 not only has the "year=2000" condition, but now also has the additional condition "state=TN". In this way, the "state=TN" predicate condition from operation 304 in query plan 300 has been propagated as an additional condition (in addition to "year=2000") to the filter operation in subplan 512. This rewritten filter operation 506 with these two conditions is applied to the fact records scanned from the "Store_Returns" fact table. Therefore, by changing the filter condition from Figure 3 504 in the sub-plan 512 is propagated to the filter operation 506 in the sub-plan 512 , and the enhancer 103 has rewritten the sub-plan 312 (or more specifically, the filter operation 304 ) into the sub-plan 512 .
[0128] Rewriting the query plan in the above manner enables filtering out any fact records not related to the state of Tennessee from the fact source Store_Return, so that computing resources are not wasted in further processing of such irrelevant fact records. Compared to sub-plan 302, the number of fact records output by filter operation 504 and sub-plan 502 and available for use by further operations in query plan 500 (e.g., join operation 508) is much smaller than the number of records output by sub-plan 302 (specifically, by the join operation in sub-plan 302) and available for use by the next operation in query plan 300. This is because filter operation 504 and sub-plan 502 only output records matching the TN condition to downstream operations in plan 500 (e.g., join operations that obtain fact records output by sub-plan 502); records not related to the state of Tennessee are filtered out. In a similar manner, the number of fact records output by filter operation 506 and sub-plan 512 and available for use by further operations in query plan 500 (e.g., join operation 508) is much smaller than the number of records output by sub-plan 312 (specifically, by the join operation in sub-plan 312) and available for use by the next operation in query plan 300 compared to sub-plan 312. This is because filter operation 506 and sub-plan 512 only output records matching the TN condition to downstream operations in plan 500 (e.g., join operation 508 that obtains the fact records output by sub-plan 512); records for states other than Tennessee are filtered out. This can significantly reduce the number of records provided to the join operation; depending on the size of the fact table, the reduction in the number of fact records can be equal to or greater than a factor of 100. Due to this reduction in the number of fact records output by sub-plans 502 and 512, plan 500, and therefore the corresponding query for which query plan 500 was generated, executes faster (due to fewer CPU cycles required for execution) and in many cases will use fewer memory resources than the unenhanced query plan 300 while analyzing the same data and returning the same query results.
[0129] exist Figure 3 and Figure 5 In the example depicted in FIG, a condition from one part of a query plan is propagated to another part of the query plan. In this example, the predicate condition (filtering based on State=TN) is propagated from one part of the query plan (e.g., from Figure 3 304 in the query plan) to another part of the query plan (e.g., to Figure 5 In this example, the operation or portion of the query plan graph to which the predicate condition is propagated is neither a descendant nor an ancestor of the portion of the tree from which the predicate condition is propagated, i.e., filter operations 504 and 506 are not descendants or ancestors of filter operation 304 in query plans 300 or 500.
[0130] Although in Figure 5 In the example of , the predicate condition from filter operation 304 is propagated to sub-plans 302 and 312 to create rewritten sub-plans 502 and 512, but it should be recognized that this is merely an example. In general, the predicate condition from the first operation in the query plan graph can be propagated and associated with different parts or operations in the query plan to generate an optimized enhanced rewritten query plan. This can depend on the available data structures (e.g., materialized views).
[0131] In some embodiments, as part of analyzing query plan 300, enhancer 103 focuses on aggregate-join sub-plans, which are sub-plans that contain only aggregate, join, projection, filter, or scan operators / operations in the entire query plan. Examples of these are Figure 3 The goal of the enhancer 103 is to find predicate conditions or filters that can be pushed into these sub-plans to scan the fact source relations.
[0132] In some embodiments, the general pattern (pattern A) that enhancer 103 looks for is:
[0133] - A node in a query plan that represents a join operation (a "join node") that defines a join condition between a fact source scan (fs) and some other table scan (ot). A join condition may be expressed as a list of equality checks between the columns of the fact source and another table (fs.col1 = ot.col1 and fs.col2 = ot.col2 and ...).
[0134] - There should not be a null supply on the fact source side, i.e., along the path scanned from the fact source to the join (j1) under consideration, there must not be another join (j2) with a null supply on the fact source side (i.e., fs cannot be a descendant of c1 which is a child of j2, where j2 is an outer join and c1 is a null supply side in j2).
[0135] Pattern A is as follows. Lines 2 and 4 of Pattern A replace any combination of aggregation / join / projection / filter operations.
[0136] 1. Join (fs.col1 = ot.col1 and fs.col2 = ot.col2 and ...)
[0137] 2. Projection / Filtering / Aggregation Operations
[0138] 3. Fact Source Scanning (fs)
[0139] 4. Projection / Filtering / Aggregation Operations
[0140] 5. Other table scans (ot)
[0141] If a subplan matching the above pattern A is found in the overall query plan, a "semi-join" restriction can be applied to the join columns of the fact source (fs.col1, fs.col2, ... in pattern A). The fact source rows can be restricted to those whose join column values match a row in OtherTable (on ot.col1, ot.col2, ...). In addition, if OtherTable has some effective filter, the fact source relation scan can be rewritten as follows:
[0142] 1. LEFT SEMI JOIN (fs.col1 = ot.col1 and fs.col2 = ot.col2 and ...)
[0143] 2. Fact Source Scanning (fs)
[0144] 3. Select different ot.col1, ot.col2, ...
[0145] 4. Filter
[0146] 5. Other Table Scan (ot)
[0147] The potential benefit of this rewrite is a reduction in fact source rows that are processed in subsequent operators in the query plan pipeline. In practice, the reduction in source rows informally depends on the selectivity of the filter on OtherTable. The more selective the filter is (e.g., an equality condition on a column with a large number of distinct values), the greater the chance of reduction in fact source rows. In the case of a star-schema join, the join will be losslessly decomposed (no new facts are added by the join), so the benefit of the dimension filter on the scanned facts is likely to be proportional to the selectivity of the filter.
[0148] The cost of this rewrite is based on how the semi-join operation is performed. In the general case, this is done using a Left Semi-Join operator, which will typically involve a join physical plan.
[0149] There are a variety of techniques that can be used to efficiently propagate predicate conditions within a query plan. The specific technique used can be selected based on various factors, including but not limited to estimated computational savings and / or the availability of certain data structures.
[0150] One technique involves performing a semi-join operation between fact records and dimension records. This can be accomplished based on evaluating a predicate condition against the dimension records to determine a set of dimension keys that satisfy the predicate condition. This set of dimension keys is referred to herein as a "key in-list".
[0151] Figure 6An example process 600 is depicted for generating key lists 602 and 604 that can be used to efficiently evaluate query A. More specifically, the predicate condition "year = 2000" is evaluated against dimension table 204 to determine key list 602, and the predicate condition "state = 'TN'" is evaluated against dimension table 208 to determine key list 604. A key list is a list of foreign keys in dimension records in the dimension tables that satisfy the predicate conditions. For example, for Date dimension table 204, Figure 6 The first record depicted in satisfies "year=2000" and date_key=1 is a foreign key from that record. Key lists 602 and 604 can be used to scan and filter fact records, thereby propagating predicate conditions to fact records.
[0152] However, performing a semi-join operation incurs a significant computational overhead. Scanning fact records can be computationally intensive because there are typically a large number of fact records. In addition, generating a key list increases the computational overhead of performing a semi-join operation. It is worth noting that the reduction of fact records that would otherwise be processed unnecessarily (e.g., fact records that are not related to the state of Tennessee) should outweigh this overhead. Therefore, the enhancer 103 can estimate the computational savings before rewriting the query plan to include a semi-join operation.
[0153] In the case of multiple predicate conditions, the query enhancer 103 may analyze the incremental savings of executing the semi-join operations successively. This may involve placing the predicate conditions in descending order of the computational savings resulting from applying each predicate condition individually. The enhancer 103 may then analyze the predicate conditions in this order to estimate the incremental savings from applying the predicate conditions successively. Thus, a semi-join operation may be specified to apply successive predicate conditions as long as the incremental savings are not insignificant.
[0154] Another technique for efficiently propagating predicate conditions to fact records involves a tabular representation of fact values (e.g., fact measure values or any other value from a fact table) joined to dimension values. It also involves one or more indexes (e.g., inverted indexes) that enable efficient access to the storage locations of dimension values included in the materialized view. In general, a tabular representation with one or more indexes is referred to herein as an "OLAP index." Typically, an OLAP index is a single composite data layout format that is optimized to scan an arbitrary subset of rows based on predicate conditions, provided that techniques such as scan-optimized column encoding, memory-optimized column layout, and vectorized scan operations are used; predicate evaluation is also highly optimized, such as as a collection of bitset operations. These features make OLAP indexes ideally suited for self-organizing analytical workloads.
[0155] Figure 7An example OLAP index 700 is depicted that includes dimension indexes 704 and 706. OLAP index 700 also includes table 702 that includes data obtained by joining fact table 202 with dimension tables 204 and 208. Figure 7 As depicted in , an OLAP index includes data in a columnar format and one or more inverted indexes on dimension values. For each dimension value, a position bitmap is maintained.
[0156] In many databases, the values in a field (e.g., column 708 or 710) are stored contiguously within a range of memory addresses. For example, when data is read from storage into system memory, the value of column 710 may be stored contiguously in volatile memory as columnar database data that can be efficiently accessed. To improve the efficiency of accessing specific column values, an index (e.g., a dimension index) may store a mapping between field values and memory locations. Figure 7 In the example of , dimension index 704 indicates memory location 714 of “state” dimension value 712 of column 710 , and dimension index 706 indicates memory location 718 of “year” dimension value 716 of column 708 .
[0157] Therefore, OLAP indexes enable saving of computing resources. Since OLAP indexes include dimension values, predicate conditions can be evaluated directly against the OLAP index without generating an in-list. In addition, the dimension value bitmap represents a mapping from dimension values to a subset of fact rows with the dimension value; each dimension predicate condition can be mapped to a bitmap or a bitmap combination: for example, State = 'TN' is a fact row in the 'TN' value bitmap, and State > 'TN' is a fact row obtained by OR-combining all bitmaps of all State values > 'TN' in the bitmap; further evaluation of multiple dimension predicate conditions can also be evaluated as very fast bitmap combination functions such as AND, OR, NOT, without having to scan the actual fact data. Functions such as Figure 7An index such as that depicted in enables predicate conditions (such as 'state="Tennessee"' and 'date="2000"') to be computed in a fast manner. OLAP index materialization enables very efficient "skip scans" to be performed. The evaluation of a predicate condition (e.g., 'state="Tennessee"' or 'date="2000"') generates a list of row identifiers, thereby identifying fact rows with data that matches the predicate condition. For example, row identifiers 1, 4, 5, 7, 9, 10, 13, 15, 17, 19, 20, 23, and 24 correspond to fact records that satisfy the 'state="Tennessee"' condition. As another example, row identifiers 1, 2, 3, 4, 5, 6, 7, and 8 correspond to fact records that satisfy the 'date="2000"' condition. During a fact scan operation, a large number of fact record rows can be skipped using the rowid list. Typically, analytical queries focus on a small area of a large multidimensional space, so skip scans are performed significantly faster than scanning all fact records (or fact rows) and then eliminating those that do not satisfy the filter predicate conditions. Therefore, using OLAP indexes with predicate conditions makes fact scan operations faster.
[0158] Although for the sake of clarity Figure 7 Memory locations 714 and 718 are depicted as decimal values, but it should be appreciated that memory locations 714 and 718 may be represented as binary values, hexadecimal values, etc. In some embodiments, memory locations 714 and 718 may be maintained as a position bitmap, thereby enabling computationally inexpensive and fast bitmap AND operations to propagate multiple predicate conditions to fact records simultaneously. Additionally, although for clarity Figure 7 Memory locations 714 and 718 are depicted as relative addresses (eg, byte offsets), but it should be appreciated that in some embodiments, memory locations 714 and 718 may be represented as absolute addresses.
[0159] In general, the benefit of evaluating a predicate condition against an OLAP index should always outweigh any computational costs. Therefore, there is no need for the enhancer 103 to perform a cost-benefit analysis. However, a suitable OLAP index may not always be available. For example, there may not be an OLAP index that includes a "state" dimension value against which the predicate condition "state='TN'" is evaluated.
[0160] Another technique for efficiently propagating predicate conditions to fact records involves a hybrid of the techniques mentioned above and is referred to herein as an "index semi-join" technique. As the name implies, an index semi-join operation is a specific type of semi-join operation involving an OLAP index, although an OLAP index is not suitable for directly evaluating predicate conditions.
[0161] Fig. 8A An example OLAP index 800 is depicted, which includes a table 802 and a dimension index 804. Table 802 includes data obtained by joining the fact table Store_Returns 202 with the dimension Store table 208. The values of column 806 can be stored continuously in volatile memory as columnar database data, and the dimension index 804 can be used to efficiently access specific column values. More specifically, the dimension index 804 maps the "city" dimension value 808 to a memory location 810 within the table.
[0162] Although for the sake of clarity Fig. 8A Memory locations 810 are depicted as decimal values, but it should be appreciated that memory locations 810 may be represented as binary values, hexadecimal values, etc. In some embodiments, memory locations 810 may be maintained as a position bitmap, thereby enabling computationally inexpensive and fast bitmap AND operations to propagate multiple predicate conditions to fact records simultaneously. Additionally, although for clarity Fig. 8A The memory location 810 is depicted as a relative address (eg, a byte offset), but it should be appreciated that in some embodiments the memory location 810 may be represented as an absolute address.
[0163] However, the dimension index 804 is not suitable for directly evaluating the predicate condition “state='TN'.” This is because the dimension index 804 is based on “city” values, not “state” values.
[0164] However, based on the index semi-join operation, the dimension index 804 can still be used to propagate the predicate condition "state='TN'" to the fact record. This can involve evaluating the predicate condition against the dimension record to determine a set of dimension values (e.g., non-key values) that satisfy the predicate condition and are included in the dimension index 804. This set of dimension values is referred to herein as a "value in-list".
[0165] Figure 8B An example process 820 is depicted for generating a value list 822 that can be used to evaluate the predicate condition "state = 'TN'" against the dimension index 804. More specifically, the predicate condition "state = 'TN'" is evaluated against the dimension table 208 to determine a value list 822 that includes one or more "city" values. Figure 8B, this returns a single city value, "Nashville." Value in-list 822 (e.g., "Nashville") can then be used to scan dimension index 804 to find memory locations corresponding to relevant records in table 802 (e.g., locations 1, 4, 5, 7, 9, 10, 13, 15, 17, 19, 20, 23, and 24 for Nashville), thereby filtering records of table 802 without scanning all records of table 802.
[0166] Although performing an indexed semi-join operation saves computational resources by avoiding scanning all fact records, it incurs computational overhead associated with generating the value entry table. It is worth noting that the reduction of fact records that would otherwise be processed unnecessarily (e.g., fact records not related to the state of Tennessee) should outweigh this overhead. Therefore, the enhancer 103 can estimate the computational savings before rewriting the query plan to include an indexed semi-join operation.
[0167] In the case of multiple predicate conditions, the enhancer 103 may analyze the incremental savings of executing the index semi-join operations successively. This may involve placing the predicate conditions in descending order of the computational savings resulting from applying each predicate condition individually. The enhancer 103 may then analyze the predicate conditions in this order to estimate the incremental savings from applying the predicate conditions successively. Thus, a semi-join operation may be specified to apply successive predicate conditions as long as the incremental savings are not insignificant.
[0168] As indicated above, inferences may be drawn not only from the star schema information 116, but also from the semantic metadata 117. Inferences drawn from the semantic metadata 117 may be used to transform predicate conditions so that they can be propagated to fact records. For example, the semantic metadata 117 may include information indicating hierarchical relationships between time values expressed in weeks, months, quarters, etc. This information may then be used to transform a condition such as a predicate condition "quarter = 2" into "month BETWEEN 4AND 6", so that the predicate condition may be evaluated for a "month" value, since Figure 2 The Date dimension table 204 depicted in FIG. 2 includes month, day, and year fields, but does not include a field for quarter. In this way, predicate conditions based on values that are not columns in the dimension table can be converted into values that are columns in the dimension table.
[0169] Fig. 9 An example 900 for propagating predicate conditions to fact records based on functional dependencies is depicted in accordance with some embodiments. Fig. 9 In the example of , "quarter = 2" is an untranslated predicate condition 904, which can be identified to be propagated to Fig. 9, which includes table 908 and dimension index 910. However, none of columns 912, 914, 916, or 918 in table 908 is a "quarter" column, which makes it difficult to evaluate predicate condition 904 against OLAP index 910.
[0170] However, the semantic metadata 901 may include dependency metadata, which may be used to transform the predicate condition 904 into a predicate condition 906 based on dimension attributes in the index 910. More specifically, the semantic metadata 901 may include a date hierarchy 902 (e.g., month to quarter, quarter to year), which may be used to transform the predicate condition "quarter=2" into a month-based predicate condition "month BETWEEN 4AND 6". Thereafter, the transformed predicate condition 906 may be evaluated against the dimension index 910, which maps the month value 920 to a storage location 922. In this example, April, May, and June satisfy the predicate condition and are mapped to their memory locations (or rowids). Although Fig. 9 An example process 900 involving OLAP indexes is depicted, but it should be appreciated that the transformed predicate conditions may be propagated to any source of fact records using any suitable technique described herein.
[0171] exist Fig. 9 In the example depicted in and described above, a quarter-based predicate condition is replaced with a month-based constraint predicate condition. The replacement constraint predicate condition does not have to be identical to the original predicate condition; it should simply return all rows (fact records) returned by the predicate condition it replaces. The replacement strategy for equality and constraints (=, !=, <, >, <=, >=, in, between) is used for level-based hierarchies. For hierarchies of reasonable size, an in-memory representation of the hierarchy can be maintained and used by the enhancer 103 during enhanced query plan generation for computing replacement predicate conditions.
[0172] Since the goal is to reduce the number of fact records processed by executing a query plan and / or reduce the overall cost of performing scan operations in a query plan, the application of predicate conditions plays an important role in achieving this goal. Fig. 9In the example depicted in and described above, the predicate condition provided in the query ("quarter=2") is different from the predicate condition that replaces the provided predicate condition ("month BETWEEN 4AND 6"). Even though the two predicate conditions are different, the application of the replacement predicate condition ensures that the replacement predicate condition also returns any rows returned by the provided predicate condition. This provides huge benefits in terms of the performance of the query plan and the performance of the query. The replacement predicate condition can be inferred by traversing functional dependencies. Therefore, in the quarter->month->week date hierarchy, if we have a predicate condition on week, then if the week column cannot be pushed to the fact source, and the fact source can handle the quarter predicate condition, then we can push in the corresponding quarter predicate condition, for example: week=1 can be pushed to quarter=1, week>25 can be pushed to quarter>2, and so on. Predicate condition transformation is based on traversing the relationship tree that defines the dependencies between the columns. If these trees are maintained as in-memory structures, then the transformation is very fast and does not add much overhead to the plan. This is definitely the case with hierarchies, in which case member navigation through in-memory data structures is generally supported.
[0173] Although Fig. 9 An example of a hierarchical relationship between a field specified in an unconverted predicate condition 904 and a field specified in a converted predicate condition 906 is depicted, but it should be appreciated that the techniques described herein are not limited to fields that exhibit a hierarchical relationship. For example, semantic metadata 901 may include other types of information that may be used to perform a conversion of predicate conditions. For example, semantic information may include information indicating that stores in the South do not sell winter clothing, thereby enabling a predicate condition expressed in terms of winter clothing to be converted into a predicate condition expressed in terms of geographic regions.
[0174] Any of the techniques described in this disclosure may be used to propagate predicate conditions to fact records. The propagation of predicate conditions exhibits a transitive nature because predicate conditions may be propagated from dimension records to fact records that may not be directly joined to fact records. For example, predicate conditions may be propagated across multiple dimension tables or across another fact table.
[0175] In some embodiments, the predicate condition can be propagated from the first set of dimension records across the second set of dimension records to the set of fact records. Fig. 10A The example depicted in is used to illustrate. Fig. 10ADepicted is example database data 1000, which includes an abbreviated form of a "Store_Returns" fact table 202, a "Customer" dimension table 1002, and a "Customer_Address" dimension table 1004. The "Store_Returns" fact table 202 can be directly joined with the "Customer" dimension table 1002 based on columns 212 and 1006, and the "Customer" dimension table 1002 can be directly joined with the "Customer_Address" dimension table 1004 based on columns 1008 and 1010. However, in Fig. 10A In the example of , there are no columns that can be used to directly join the “Store_Returns” fact table 202 with the “Customer_Address” dimension table 1004 .
[0176] However, the enhancer 103 can use the star schema information 116 to infer that the predicate condition “state='TN'” can be propagated from the “Customer_Address” dimension table 1004 to the “Store_Returns” fact table 202 because they are each related to the “Customer” dimension table 1002. Based on this inference, the enhancer 103 can check for a table (or any other source of fact records) that relates the columns of the “Store_Returns” fact table 202 to the columns of the “Customer_Address” dimension table 1004.
[0177] Fig. 10B Only such table 1020 is depicted. Fig. 10B In the example of , table 1020 includes data resulting from a join operation involving the “Store_Returns” fact table 202 and the “Customer_Address” dimension table 1004 using columns 212 and 1006, and using columns 1008 and 1010 between the “Customer” dimension table 1002 and the “Customer_Address” dimension table 1004. Thus, table 1020 includes a “state” column 1022 that corresponds to the “state” column 1012 of the “Customer_Address” dimension table 1004.
[0178] Any of the techniques described herein may be used to propagate the predicate condition "state='TN'" to table 1020. For example, if there is an inverted index for the values of column 1022 in table 1020, the predicate condition may be evaluated against the inverted index to filter table 1020 to scan only fact rows that satisfy the "state='TN'" predicate condition.
[0179] for Fig. 10A and Fig. 10B In the example depicted in , the predicate condition can be propagated if the following conditions are met:
[0180] It has been inferred that the fact source Store_Returns table 202 (FS1) can be reduced based on filtering of the dimension table Customer 1002 (T1).
[0181] The join between FS1 and T1 is a star schema. This means that this join operation does not add or remove any input fact records to the join.
[0182] A join between T1 and the dimension table Customer_Address 1004 (T2)
[0183] - Not empty supply on T1 side
[0184] - is a star schema join in FS1.StarSchema then: if for each join column jc of T1 in T1 in join T1-T2, there exists an equivalent column ec in FS1 i , then you can use the ec in FS1 i Columns to apply the semiJoin restriction to.
[0185] In some embodiments, the evaluation of the predicate condition may be propagated from a set of dimension records (from dimension table DT) across a first set of fact records (fact source 1 "FS1") to a second set of fact records (fact source 2 "FS2"). This may be possible, for example, when a star schema includes multiple sets of fact records. Fig.11 An example of such an architecture 1100 is depicted. The architecture 1100 includes two fact tables (shown with emphasized boundaries):
[0186] "Store_Returns" fact record table 1102 and "Store_Sales" fact record table 1104. The other tables (Date, Store, Item, Customer, Customer_Address) are dimension tables that store context information for fact records. Each of these two fact tables can be joined with these dimension tables (such as with "Store" dimension record table 1106).
[0187] Fig. 12ADepicted is example database data 1200 that may be described in schema 1100. Database data 1200 includes a "Store_Returns" fact table 1202, a "Store" dimension table 1204, and a "Store_Sales" fact table 1206. Although FIG. 12 depicts database data 1200 as tables, it should be appreciated that database data 1200 may be represented as indexes, materialized views, and / or any other set of tuples.
[0188] The "Store_Returns" fact table 1202 and the "Store" dimension table 1204 can be joined based on columns 1208 and 1210, which exhibit a foreign key-primary key relationship. Therefore, a predicate condition involving either of columns 1212 and 1214 (e.g., "state = 'TN'") can be propagated from the "Store" dimension table 1204 to the "Store_Returns" fact table 1202 using any of the techniques described herein.
[0189] However, the "Store_Sales" fact table 1206 can also be joined with the "Store" dimension table 1204. This is because columns 1216 and 1210 also exhibit a foreign key-primary key relationship. Fig.11 , enhancer 103 can infer that any filtering of the “Store_Returns” fact table 1202 can also be applied to the “Store_Sales” fact table 1206 using any of the techniques described herein.
[0190] Fig. 12B An example logical query plan 1220 is depicted that includes query sub-plans 1222, 1224, and 1226. According to query plan 1220, a join operation 1230 is performed between the result of executing the operations in sub-plan 1222 and the result of executing the operations in sub-plan 1224. In addition, plan 1220 specifies performing a join operation 1232 between the result of executing the operations in sub-plan 1226 and the result of executing the operations in sub-plan 1226.
[0191] Although filter operation 1228 is included in subplan 1222, filter operation 1228 is not included in subplans 1224 and 1226. This can result in a significant amount of unnecessary processing of all fact records from "Store_Returns" fact table 1202 when join operation 1230 is performed. In a similar manner, a significant amount of unnecessary processing is performed when join operation 1232 is performed on all fact records returned from "Store_Sales" fact table 1206 from subplan 1226. This unnecessary processing can significantly increase the overall time taken to execute query plan 1220.
[0192] Fig. 12C An example rewritten enhanced query plan 1240 is depicted, which has been rewritten based on query plan 1220 to reduce the number of fact records processed by the query plan. According to plan 1240, the predicate condition "State = TN" in filter operation 1228 is not only propagated to sub-plan 1224 as filter operation 1242, but also propagated to sub-plan 1226 as filter operation 1244. Therefore, the number of fact records output by sub-plan 1224 and provided to join operation 1230 (assuming that the Store_Returns table holds records where state is not TN) is less than the number of fact records provided to join operation 1230 in query plan 1220. This is because, in plan 1240, only fact records from fact table Store_Returns that satisfy the "state = 'TN'" predicate condition are provided to join operation 1230, rather than all fact records in plan 1220. In a similar manner, the number of fact records output by sub-plan 1226 and provided to join operation 1232 (assuming that the Store_Sales table holds records where the state is not TN) is less than the number of fact records provided to join operation 1232 in query plan 1220. This is because, in plan 1240, only fact records from fact table Store_Sales that satisfy the "State = 'TN'" condition are provided to join operation 1232, rather than all fact records in plan 1220. Therefore, by first filtering out any rows of the "Store_Returns" fact table 1202 and the "Store_Sales" fact table 1206 that do not satisfy the dimension predicate condition "State = 'TN'", the computational overhead of performing join operations 1230 and 1232 can be significantly reduced. Therefore, query plan 1240 executes faster (e.g., uses fewer CPU cycles) than the unenhanced query plan 1220, and can use fewer memory resources in many cases.
[0193] As described above, in certain embodiments, techniques are disclosed for transitively propagating context among subqueries involving the same fact (queries involving analysis of multiple granularities of facts) or different facts (e.g., queries involving comparison / combination of different activities). In certain embodiments, these techniques may be applied if the following conditions hold:
[0194] · The dimensional context application based on the dimension table DT on the fact source FS2 has been determined.
[0195] There is another fact source FS1 joined with FS2 on the key columns of DT, and DT is also a dimension table in the FS2 star schema.
[0196] If the above conditions hold, then the dimensional context from DT can be applied to FS1.
[0197] Fig.13A 13 is a simplified flowchart 1300 depicting a method for generating an enhanced query plan according to certain embodiments. Process 1300 can be implemented in software (e.g., code, instructions, program) executed by one or more processing units (e.g., processors, cores) of a corresponding system, hardware, or a combination thereof. The software can be stored on a non-transitory storage medium (e.g., on a memory device). The method presented in FIG. 13 and described below is intended to be illustrative and not limiting. Although FIG. 13 depicts various processing steps occurring in a particular order or sequence, this is not meant to be limiting. In certain alternative embodiments, the steps may be performed in a somewhat different order, or some steps may also be performed in parallel.
[0198] At 1302, a first or original query plan can be received. The original query plan can be a query plan provided to Figure 1A and Figure 1B The query may be an ad hoc query run against non-pre-aggregated data stored in the database. Figure 1B In the embodiment depicted in , an original query plan may be generated by the optimizer 114 .
[0199] The original query plan may include a pipeline of operations (or operators). The operations (operators) may include, for example, fact scans (sometimes referred to simply as scan operations), filtering, joins, aggregations, projections, and other operations. The operations in the original query plan may be organized hierarchically in a pipeline so that the output of the operation is provided as input to other (one or more) downstream operations. The query plan may be represented hierarchically as a rooted tree including parent nodes and child nodes. In this representation, operations are performed starting with the operations represented by the leaf nodes of the tree. The outputs from the leaf nodes are then provided to the parent nodes, the outputs from the parent nodes are provided to the parents of these parent nodes, and so on, until the root node that provides the outputs from the root node is the result of the query for which the query plan was generated. For example, the original query plan received in 1302 may be as follows: Figure 3 and / or Fig. 12B As depicted in .
[0200] One or more operations in the original query plan can be grouped to form a sub-plan. For example, the original query plan can include a first sub-plan that includes a fact table scan operation that involves scanning a source of fact records (e.g., a fact table). The first sub-plan can also include zero or more other operations, such as filtering, joining, aggregation, and projection operations. For example, Figure 3 The sub-plan 302 depicted in Fig. 12B 1222, 1224, and 1226 are depicted in FIG. In the original query plan, the fact record output by the first sub-plan (i.e., output from the first sub-plan as a result of executing the operation in the first sub-plan) is provided as input to the parent operation in the original query plan pipeline.
[0201] At 1304, an enhanced query plan is generated by rewriting the original query plan. As a result of the rewriting, in the resulting enhanced query plan, the evaluation of at least one dimension predicate condition is propagated to and associated with a fact scan operation in the enhanced query plan, wherein the predicate condition is not associated with the same fact scan operation in the original query plan. For example, the predicate condition may be inserted into the first sub-plan and associated with at least one fact scan operation in the first sub-plan. In the enhanced query plan, the predicate condition is evaluated as part of the sub-plan based on propagating the predicate condition to the fact table. As a result of the propagation and association of the predicate condition with the first sub-plan and the fact scan operation, the enhanced query plan is executed faster than the original query plan. For example, in some cases, due to the association of the predicate condition with the fact scan operation, fewer fact rows / records are processed by the enhanced query plan compared to the original query plan. This is because only those fact records that satisfy the predicate condition are provided to the parent operation or downstream operation in the query plan pipeline; fact records that do not satisfy the predicate condition will be filtered out and not provided to the parent operation, which may be, for example, a join operation. This results in a reduction in the number of fact records provided to the next and subsequent operations in the query plan pipeline. This reduces the computational overhead associated with subsequent execution of join operations and other subsequent operations in the query plan pipeline. Since fewer fact records need to be processed and carried forward in the query plan pipeline, the enhanced query plan executes faster and uses fewer resources (e.g., processing resources, memory resources) than the original query plan.
[0202] In some other cases, the predicate condition associated with a fact scan operation is such that, even though the total number of fact records output from the fact scan operation to downstream operations in the query plan pipeline may not be reduced, the cost associated with executing the fact scan operation (e.g., CPU cycles or time required to execute the fact scan operation) is reduced compared to the same fact scan operation in the original query plan.
[0203] Thus, the enhanced query rewritten in 1304 executes faster than the original query plan received in 1302. Thus, the query for which the enhanced query plan is generated executes faster and may use less memory resources. Thus, the enhanced query plan is an enhancement and improvement to the original query plan. Figure 1BIn the illustrated embodiment, the processing in 1304 may be performed by the enhancer 103 .
[0204] At 1306, the enhanced query plan generated in 1304 may be executed. As indicated above, due to the propagation of one or more predicate conditions to one or more operations in the query plan, the enhanced query plan executes faster (i.e., uses less time) than the original query plan that was not enhanced, and in many cases uses fewer memory resources.
[0205] At 1308, the fact records retrieved from the database as a result of executing the enhanced query plan at 1306 may be output as a response to the query for which the original query plan and the enhanced query plan were generated. Figure 1B In the embodiment depicted in , the processing in 1306 and 1308 may be performed by the executor 105 .
[0206] Fig. 13B is a simplified flow chart 1320 depicting a method for generating an enhanced query plan according to some embodiments. Fig. 13B The processing in the can be implemented in software (e.g., code, instructions, program) executed by one or more processing units (e.g., processors, cores) of the corresponding system, hardware, or a combination thereof. The software can be stored on a non-transitory storage medium (e.g., on a memory device). Fig. 13B The methods presented in and described below are intended to be illustrative rather than limiting. Fig. 13B Various processing steps that occur in a particular order or sequence are depicted, but this is not meant to be limiting. In some alternative embodiments, these steps may be performed in a different order, or some steps may be performed in parallel.
[0207] In some embodiments, Fig. 13B The processing depicted in Fig.13A The processing performed in step 1304 is performed as part of the processing performed in step 1304. Figure 1B In the embodiment depicted in Fig. 13B The processing depicted in can be performed by enhancer 103. The input of enhancer 103 includes the original query plan generated for the query, for example, the SQL query plan generated for the SQL query. Enhancer 103 can also access metadata information and schema information (such as information about relational schema, star schema definition, functional dependencies between columns of a table), available physical structure of data (such as OLAP indexes on star schema), etc. Fig. 13B For the purposes of this and the accompanying descriptions, it is assumed that metadata and schema information is stored in a meta-repository. Fig. 13BThe output of the processing depicted in is an enhanced query plan that executes faster than the original query plan and, in many cases, uses fewer resources than the original query plan while returning the same results as the original query plan. As described above, the enhanced query plan executes faster than the original query plan because the number of fact records processed by the enhanced query plan is less than that of the original query plan, and / or the cost of processing the fact records in the enhanced query plan is less than that in the original query plan because the fact records are processed more efficiently.
[0208] like Fig. 13B As depicted in , at 1322, the original query plan is analyzed to identify fact tables in the original query plan. This can be performed using a variety of different techniques. For example, the fact tables in the original query plan can be identified by matching tables in the original query plan with fact tables in the metastore, by user prompts at the query level or session / connection level, and other techniques.
[0209] At 1324, for each fact table identified in 1322, a query plan traversal is performed in the original query plan for each fact scan operator on the identified fact table to compute the set of validating joins with this fact scan operator and determine / infer any applicable dimension context predicate conditions. In some embodiments, traversing the fact table scan operators in the original query plan involves starting at the fact scan operator and traversing the original query plan until the root node of the original query plan is reached. For example, for Figure 3 , traversal of the Store_Returns fact table scan operation in subplan 302 involves starting at this node 320 and visiting all of its ancestor nodes: node 322 , node 324 , node 306 , and so on, up to and including root node 326 .
[0210] In order to identify / infer applicable dimensional context predicate conditions for fact scan operations of fact tables during traversal, the enhancer 103 maintains the "granularity" of the output of each visited node operation / operator. The output of any relational operator in the query plan is a calculated dataset. The "granularity" of any table (base dataset) or calculated dataset is the set of dimension columns in its schema. For a fact table, its granularity includes all associated dimension keys. For example, in Figure 4In the example, the granularity of Store_Returns is Date_key, Item_key, Store_key, Customer_key. Additionally, for each dimension, since all attributes are functionally determinable from the key attribute, they are valid at the granularity of the fact table. So, for example, Year, Quarter, Month, etc. are determinable from Date_key, so they are valid at the granularity of Store_Returns. Applying similar arguments, Figure 4 All dimension columns in are valid at the granularity of the Store_Returns table.
[0211] Now in Figure 3 In , the aggregator operation / operator 324 outputs rows by Customer_key, Store_key, so the granularity of the data set defined by operation 324 is Store_key, Customer_key. But again, through functional dependencies, all Customer and Store columns are valid in their granularity. So, for the fact table Store_Returns, in Figure 4 A dataset with schema (Cust_Name, Item_Category, Store_Name, Qty) defined on the star schema depicted in can have granularity (Cust_Name, Item_Category, Store_Name).
[0212] At the start of the traversal, the granularity of the fact table for the fact scan operation is all the attributes in the associated dimension of the fact table. Figure 3 For Store_Returns in subplan 302, this would be all columns from the Date, Item, Store, and Customer dimension tables, as well as the auxiliary Customer attribute from the Customer_Address dimension table. Figure 4 The star schema for the fact table definition in .
[0213] During the traversal in 1324, special processing is performed after encountering a node corresponding to a join operation. This involves capturing a confirmed join with the fact table and attempting to infer applicable context that can be propagated from the "other side" of the join to the fact scan operation side or the "fact side". For example, in Figure 3 In , for the join operation node 322, the fact side will be the Store_Returns node 320, and the other side will be the filter operation node 328. As another example, in Figure 3 , for node 306 , the fact side would be the left subplan 302 , and the other side would be the right subplan 312 .
[0214] A validation join means that the join does not change the granularity on the fact side. For example, one of the most common validation patterns involves the same join conditions as on the edges in a star schema. Figure 4 , joins would have to be between Store_Returns and Store on store_key, or Store_Returns and customer_key, etc. In contrast, examples of non-validating joins would include a join between a Store_Returns materialization (such as a materialized view or OLAP index) and Customer on customer_name, or a join between the Store_Returns and Store_Rent tables on store_name; here Store_Rent is not part of the star schema.
[0215] After encountering a confirming join, the inference logic then checks the following additional condition when confirming the join: The fact side granularity must include the dimension granularity being joined. If this is the case, then any context (predicate conditions) on the other side of the join that is functionally determined by the join granularity applies to the fact side and therefore to the fact table. For example, for Figure 3 , for the leftmost "join on Date Key" node 322, the left fact-side subtree of the join operator has the granularity "Customer, Item, Date, Store", and the join on the other side is on the "Date" dimension; therefore, this is a confirmatory join at the granularity of Date Key. All Date attributes can be determined by the Date Key, so the predicate on Year can be propagated to the fact scan operation on the fact table Store_Returns represented by node 320. A similar analysis can be performed on the fact scan operation on Store_Returns in subplan 312.
[0216] Information about applicable granularities is maintained and updated during traversal. First, all dimension attributes in the granularity are identified. Figure 3 324 and 330 in the example above), the granularity is changed to the grouping column. Figure 3 , the granularity becomes (Customer_key, Store_key) when traversing the aggregate operation / operator in node 324. In some embodiments, rules are configured and maintained on how to modify and maintain granularity with respect to traversing different types of relational operations / operators found in a query plan.
[0217] As part of the traversal in 1324, for each fact table scan operator, information is maintained by the enhancer 103, including a list of confirmed joins with the join tables involved, a list of applicable one or more dimension context predicate conditions that have been identified or inferred for that fact scan operation. At the end of the traversal of the fact scan operation, the fact scan operator being traversed has applicable one or more dimension contexts (predicate conditions) and a candidate list of confirmed joins.
[0218] At 1326, transitive fact-to-fact inference of predicate conditions is performed. This process involves transitive inference of predicate conditions across the same fact or different facts. For each pair of fact scan operators, say "fs1" (fact scan on fact table ft1) and "fs2" (fact scan on fact table ft2), the enhancer 103 looks for a join operator such that the join condition has a join attribute D1.ja on dimension D1 such that D1 is in the star schema of both ft1 and ft2.
[0219] For example, in Fig. 12B middle:
[0220] - fs1 is Store_Returns scan (block 1224);
[0221] - fs2 is the Store_Sales scan (block 1226);
[0222] -The join connecting the two fact tables is node 1232;
[0223] - the public dimension D1 is the Store dimension; and
[0224] - The join is on the Store_key attribute of the Store.
[0225] After finding such a pattern, if both fact tables involved are at the granularity of the join attribute D1.ja, then the enhancer 103 can propagate any inferred dimensional context over dimension D1, which is functionally determined by the granularity of the join from fs1 to fs2, and vice versa. Fig. 12B , the inferred contextual predicate condition "State=TN" from the Store_Returns scan (block 1224) can be propagated to the Store_Sales scan (node 1226) via the join on Store_key in block 1232. This fact-to-fact inference is transitive; thus dimensional context can be propagated from fs1 (on ft1) to fs2 (on ft2) to f3 (on ft3), and so on.
[0226] At 1328, a transitive fact-to-dimension inference of the predicate condition is performed. Since the star schema can be a snowflake schema, the length of the join path from the dimension table to the fact table in the star schema can be greater than one. Fig.17 The architecture 1700 depicted in FIG. 17 is used to describe the processing in 1328. Fig.17 In the example, Store_Returns is the fact table, and the other tables are dimension tables (note that schema 1700 is Figure 4 400 depicted in FIG. 4 ). Figure 4 , Income_Band is associated with Store_Returns via only a four-table join: Income_Band joins Customer_Demographics joins Customer joins Store_Returns. If there is a physical representation of Store_Returns that contains the Income_Band attribute, such as an OLAP index on Store_Returns that contains the income_upper_bound attribute, then the Income_upper_bound predicate can be applied on it. In order for the enhancer 103 to infer the application of the Income_upper_bound context (predicate) on the OLAP index fact source, it must propagate it through the triple join that connects the Income_Band dimension table to the fact table (Income_Band joins Customer_Demographic, Customer_Demographic joins Customer, and Customer joins Store_returns). This is done by recursively building a list of validating joins for the fact scan operator, and each time a new applicable validating join is encountered, an attempt is made to propagate any available dimensional context from the other side, as shown in 1324.
[0227] At 1330, one or more inferred dimension context predicate conditions are applied and associated with the fact scan operation. To this point, each fact table scan operation / operator (or, in general, fact source scan operation) identified in the original query plan is associated with a list or set of one or more applicable dimension context predicate conditions, where applicable. As part of the processing at 1330, the predicate conditions identified for each fact scan operation are sorted according to their net benefit, where the net benefit of the predicate condition is the cost of processing the fact row after applying the predicate condition minus the cost of applying the predicate condition.
[0228] Thus, for each fact scan operation, the enhancer 103 may calculate a net benefit metric for each predicate condition in the list of applicable predicate conditions determined for that fact scan operation as part of 1330. The enhancer 103 may consider several factors to calculate the net benefit metric and perform the ranking, such as:
[0229] - An available physical representation of the fact, such as an OLAP index on the fact and the availability of columns in the OLAP index. Note that not all dimension columns need to be in the OLAP index.
[0230] - The selectivity of the inferred dimension context; highly selective predicates outperform low-selectivity predicates.
[0231] - The cost of applying the dimension context predicate condition. For example, pushing the predicate to an OLAP index scan incurs almost no additional cost and is therefore preferred;
[0232] Index semi-join is superior to traditional semi-join because it takes advantage of the ability to perform efficient skip scans in index scan operations / operators.
[0233] As part of 1330, after the sorting, for each fact scan operation, one or more predicate conditions are determined from the list of predicate conditions to be associated with the fact scan based on the sorting. In some embodiments, for the fact scan operation, the predicate condition from the list that provides the best net positive benefit is selected to be associated with the fact scan operation.
[0234] In some embodiments, for a fact scan operation, more than one predicate condition from the ordered list of predicate conditions for the fact scan operation may be associated with the fact scan operation. In such a scenario, after the predicate condition that provides the highest net benefit has been associated with the fact scan operation, for each additional predicate condition in the ordered list, starting with the predicate condition that provides the next best net benefit, a net benefit analysis is performed taking into account the association of that additional predicate condition with all previously associated predicate conditions for that fact scan operation to determine whether the additional predicate condition is to be associated with the fact scan operation. When multiple predicate conditions are associated with a fact scan operation, the benefit of applying the additional predicate conditions generally decreases with the number of associated predicate conditions.
[0235] After processing in 1330, for a particular fact scanning operation, it is possible that any one of the one or more predicate conditions identified as applicable to that fact scanning operation does not provide a net benefit. In this case, no predicate condition can be associated with that fact scanning operation.
[0236] In 1332, the enhancer 103 performs processing to determine whether the execution of the query plan can be further optimized by inferring any new one or more predicate conditions for one or more fact scan operations in the query plan based on the existing predicate conditions associated with the fact scan operations. The existing predicate conditions of the fact scan operations may be predicate conditions associated with the fact scan operations in the original query plan (original predicate conditions) and / or predicate conditions associated with the fact scan operations after the processing performed in 1330. Thus, as part of the processing performed in 1332, if the new predicate conditions provide a greater net benefit to the fact scan operations than the original predicate conditions, then the enhancer 103 may attempt to find new transformed predicate conditions based on the original predicate conditions associated with the fact scan operations. In a similar manner, for the predicate conditions associated with the fact scan operations in 1330, if the new predicate conditions provide a greater net benefit to the fact scan operations than the predicate conditions associated with the fact scan operations in 1330, then the enhancer 103 may attempt to find new transformed predicate conditions based on the associated predicate conditions.
[0237] In some embodiments, as part of 1322, enhancer 103 attempts to find implicit predicates from among the identified / inferred predicates based on functional dependencies between dimension attributes. Figure 3 In the query plan depicted in Figure 5 The block 502 of FIG. 1 shows the application of the predicate condition “State=TN” to the left Store_Returns. Assume that this application of “State=TN” is not cost-effective, perhaps because the available OLAP index does not have the State attribute. In this case, the enhancer 103 can use the following metadata information to infer the new predicate condition:
[0238] -State and City are listed in a hierarchy;
[0239] - "TN" has only 2 cities listed in the database; and
[0240] -City column is in the OLAP index.
[0241] The above information can be used to possibly infer that the "State = TN" dimension context can be applied as "City = Memphis or City = Nashville", where the application of the inferred predicate condition involves a very fast OLAP index scan. Applying this inferred predicate condition can provide a net benefit to the query plan that performs an overall enhancement. Another example of a transformed predicate condition is in Fig. 9 Depicted in and described above.
[0242] In some embodiments, the processing in 1322 is performed for a fact scan operation in a query plan only when: there are no original predicate conditions associated with the fact scan operation (i.e., in the original query plan); based on the processing performed in 1324, 1326, and 1328, at least one predicate condition is identified in the list of predicate conditions eligible to be associated with the fact scan operation; and based on the processing performed in 1330, it is determined that none of the predicate conditions in the list determined for the fact scan operation provides any positive net benefit and is therefore not associated with the fact scan operation in 1330. In such a scenario, the enhancer 103 may perform the processing in 1332 on one or more predicate conditions in the list of predicate conditions identified for the fact scan operation to see if any such transformed new predicate conditions provide a positive net benefit for the fact scan operation. If such a transformed new predicate condition is found, it may be associated with the fact scan operation by the enhancer 103 at 1332. However, this is not intended to be limiting. In some other embodiments, the processing in 1332 may be performed for any original predicate conditions and / or any predicate conditions associated with the fact scanning operation in 1330 .
[0243] At 1334, an enhanced query plan is generated based on the original query plan, the query plan having one or more predicate conditions associated with the one or more fact scan operations. In some embodiments, the original query plan is rewritten into an enhanced query plan so that one or more predicate conditions identified in the enhanced query plan as being associated with the one or more fact scan operations are actually associated with the fact scan operations. Thus, when the enhanced query plan is executed at 1308 as part of executing the query, the associated predicate conditions are evaluated for the fact scan operations with which they are associated.
[0244] The enhanced query plan generated based on the teachings disclosed herein provides several benefits over conventional techniques. As described above, analytical queries such as SQL queries often involve calculations on multiple dimensions and require multiple layers of calculations on one or more fact tables combined by navigation dimension associations. As an example, a common example of a dimension association is a hierarchy, such as Year-Quarter-Month or Country-State-City, etc. Figure 3In the example depicted in , sub-plan 302 involves calculating the Store Returns of Customers at each Store, and sub-plan 312 involves calculating the aggregated returns of all Customers of a Store at a Store. At node 306, these two are combined to discover "problem" customers. This terabyte (or even higher) scale and multi-layer calculations outside the database are very computationally intensive, and it is very challenging to answer any query within the "thinking time". The various inventive technologies disclosed herein provide an analytical platform that enables an interactive experience for self-organizing queries at such a scale including but not limited to OLAP plus indexing, and horizontally scales out a shared-nothing architecture. The analytical platform described herein provides the ability to run interactive self-organizing queries on very large (terabytes and above) multidimensional data (e.g., data stored in a data lake) in a very cost-effective manner; in the past, running such interactive self-organizing queries on very large (terabytes and above) multidimensional data using conventional techniques was very expensive and unscalable.
[0245] For queries, the analyst's goal is often to focus on a small region of a vast multidimensional space. Figure 3 In the example above, the focus of the analysis is the state of Tennessee. But for query languages like SQL, this analytical context becomes obscure because it would be clumsy to write such multidimensional calculations using relational algebra operators. Further SQL writing is often done by SQL Generator tools or data engineers who are not domain experts, whose goal is to produce SQL that gives the right answer; they are not interested in carrying semantic information in a way that makes it easy for SQL query engines to generate query plans that avoid unnecessary fact processing, just like the analysis of "Tennessee State". Conventional relational query optimizers run on relational schemas and therefore lack knowledge of the very valuable multidimensional cube semantic model, which is the basis for how to express analytical problems; this model comes to mind for every analyst. The analytical platform disclosed in this article performs processing to reverse engineer the context of the analysis from the structure of the query plan by making full use of the relationships defined in the multidimensional cube semantic model. In many cases, this leads to inferring applicable dimensional context (predicate conditions) that significantly reduces the resources required to process facts. At big data scales (e.g., terabyte scales) and above, as described herein, the reduction in fact processing costs has a significant impact on the ability to interactively process self-organizing queries.
[0246] As described above, an analysis platform is provided for making analysis queries more efficiently executed. In certain embodiments, an Apache Spark native analysis platform is provided. Query plans generated for analysis queries (e.g., SQL queries) are optimized to create optimized and enhanced query plans. Semantic information (such as business data and business intelligence data) is used to generate enhanced query plans. Domain semantics is used to generate more efficient query plans. Business semantics is used for query execution optimization.
[0247] From a performance perspective, enhanced query plans execute faster than unenhanced query plans (because they require fewer CPU cycles to complete their execution) and can use fewer memory resources in many cases. As a result of the rewritten query plan, the corresponding query can execute an order of magnitude faster (e.g., 10X, 25X, 100X, etc.) than before the rewrite. This is because fact tables are several orders of magnitude larger than dimension tables, so reducing the scan costs associated with processing fact records results in a huge performance improvement.
[0248] As indicated earlier, the analytical platform described in this article can be implemented as an Apache Spark native solution using a Spark cluster. Therefore, it fully utilizes the capabilities of Apache Spark and its ecosystem, such as core components, scalable memory runtime, catalyst components, JDBC, metastore, etc.
[0249] As described herein, techniques for generating optimized query plans are described, wherein the cost of processing and scanning fact records through an enhanced query plan is reduced as compared to an unenhanced query plan. Analysis activities often focus on specific sub-populations or sub-contexts rather than entire data sets. Inferring the context applicable to the query from semantic information and applying the context to the query plan (e.g., through context or predicate condition propagation) can result in significant performance improvements in the query plan and, therefore, the execution of the query for which the query plan is generated. Regardless of the analysis domain or analysis activity, there are common patterns that can be identified to determine the context of the analysis. In certain embodiments, techniques for identifying these patterns and generating optimized enhanced query plans are provided.
[0250] Fig.14 A simplified diagram of a distributed system 1400 for implementing an embodiment is depicted. In the illustrated embodiment, the distributed system 1400 includes one or more client computing devices 1402, 1404, 1406, and 1408 coupled to a server 1412 via one or more communication networks 1410. The client computing devices 1402, 1404, 1406, and 1408 may be configured to execute one or more applications.
[0251] In various embodiments, server 1412 may be adapted to run one or more services or software applications that enable execution of analytical queries as described above.
[0252] In some embodiments, the server 1412 may also provide other services or software applications that may include non-virtualized and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as under a software as a service (SaaS) model, to users of client computing devices 1402, 1404, 1406, and / or 1408. Users operating client computing devices 1402, 1404, 1406, and / or 1408 may in turn utilize one or more client applications to interact with the server 1412 to utilize the services provided by these components.
[0253] exist Fig.14 In the depicted configuration, the server 1412 may include one or more components 1418, 1420, and 1422 that implement the functions performed by the server 1412. These components may include software components, hardware components, or a combination thereof that may be executed by one or more processors. It should be appreciated that a variety of different system configurations are possible that may differ from the distributed system 1400. Thus, Fig.14 The embodiment shown in is one example of a distributed system for implementing an embodiment system and is not intended to be limiting.
[0254] According to the teachings of the present disclosure, a user may submit an analysis query using client computing devices 1402, 1404, 1406, and / or 1408. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via this interface. For example, query results may be output to the user via an interface provided by the client device. Although Fig.14 Only four client computing devices are depicted, but any number of client computing devices may be supported.
[0255] Client devices may include various types of computing systems, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, gaming systems, thin clients, various messaging devices, sensors and other sensing devices, etc. These computing devices may run various types and versions of software applications and operating systems (e.g., Microsoft Apple or UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome TM OS), including various mobile operating systems (e.g., Microsoft Windows Windows Android TM , Palm Portable handheld devices may include cellular phones, smart phones (e.g., ), tablets (e.g. ), personal digital assistants (PDAs), etc. Wearable devices can include Google Head-mounted displays and other devices. Gaming systems can include various handheld gaming devices, Internet-enabled gaming devices (e.g., with or without Gesture Input Devices Microsoft Game consoles, Sony System, by Various game systems provided by and others), etc. The client device may be able to execute a variety of different applications, such as various Internet-related applications, communication applications (e.g., email applications, short message service (SMS) applications), and may use various communication protocols.
[0256] The communication network(s) 1410 may be any type of network familiar to those skilled in the art, which may support data communications using any of a variety of available protocols, including but not limited to TCP / IP (Transmission Control Protocol / Internet Protocol), SNA (Systems Network Architecture), IPX (Internetwork Packet Exchange), The network(s) 1410 may be, by way of example only, a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., in any of the Institute of Electrical and Electronics Engineers (IEEE) 1002.11 protocol suites, and / or any other wireless protocol operating under the network) and / or any combination of these and / or other networks.
[0257] Server 1412 may include one or more general-purpose computers, dedicated server computers (including, by way of example, PC (personal computer) servers, The server 1412 may include a server, a mid-range server, a mainframe computer, a rack-mounted server, etc.), a server farm, a server cluster, or any other suitable arrangement and / or combination. The server 1412 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization, such as one or more flexible pools of logical storage devices that may be virtualized to maintain a virtual storage device of the server. In various embodiments, the server 1412 may be adapted to run one or more services or software applications that provide the functionality described in the foregoing disclosure.
[0258] The computing system in the server 1412 can run one or more operating systems, including any of the operating systems discussed above and any commercially available server operating system. The server 1412 can also run any of a variety of additional server applications and / or middle-tier applications, including HTTP (Hypertext Transfer Protocol) servers, FTP (File Transfer Protocol) servers, CGI (Common Gateway Interface) servers, Servers, database servers, etc. Exemplary database servers include but are not limited to (International Business Machines) and other commercially available database servers.
[0259] In some implementations, server 1412 may include one or more applications to analyze and integrate data feeds and / or event updates received from users of client computing devices 1402, 1404, 1406, and 1408. As examples, data feeds and / or event updates may include, but are not limited to, data received from one or more third-party information sources and continuous data streams. feed, Updates or real-time updates, which may include real-time events related to sensor data applications, financial quote machines, network performance measurement tools (e.g., network monitoring and traffic management applications), clickstream analysis tools, automobile traffic monitoring, etc. Server 1412 may also include one or more applications that display data feeds and / or real-time events via one or more display devices of client computing devices 1402, 1404, 1406, and 1408.
[0260] The distributed system 1400 may also include one or more data repositories 1414, 1416. In some embodiments, these data repositories may be used to store data and other information. For example, one or more data repositories 1414, 1416 may be used to store data, metadata, etc. The data repositories 1414, 1416 may reside in a variety of locations. For example, a data repository used by a server 1412 may be local to the server 1412, or may be remote from the server 1412 and communicate with the server 1412 via a network-based or dedicated connection. The data repositories 1414, 1416 may be of different types. In some embodiments, the data repository used by the server 1412 may be a database, such as a relational database, such as a database provided by Databases provided by companies and other suppliers. One or more of these databases may be adapted to respond to SQL formatted commands to implement storage, updating, and retrieval of data to or from the database.
[0261] In some embodiments, the application may also use one or more of the data repositories 1414, 1416 to store application data. The data repositories used by the application may be of different types, such as, for example, a key-value store, an object store, or a general purpose store backed by a file system.
[0262] In certain embodiments, the functionality provided by the analytics platform described in this disclosure may be provided as a service via a cloud environment. Fig.15 is a simplified block diagram of a cloud-based system environment in which various services may be provided as cloud services according to certain embodiments. Fig.15 In the illustrated embodiment, cloud infrastructure system 1502 may provide one or more cloud services that may be requested by a user using one or more client devices 1504, 1506, and 1508. Cloud infrastructure system 1502 may include one or more computers and / or servers, which may include those servers described above with respect to server 1412. The computers in cloud infrastructure system 1502 may be organized as general-purpose computers, dedicated server computers, server farms, server clusters, or any other suitable arrangement and / or combination.
[0263] The network(s) 1510 can facilitate communication and data exchange between the client devices 1504, 1506, and 1508 and the cloud infrastructure system 1502. The network(s) 1510 can include one or more networks. The networks can be of the same or different types. The network(s) 1510 can support one or more communication protocols (including wired and / or wireless protocols) to facilitate communication.
[0264] Fig.15The embodiment depicted in FIG. 1 is merely one example of a cloud infrastructure system and is not intended to be limiting. It should be appreciated that in some other embodiments, the cloud infrastructure system 1502 may have more Fig.15 More or fewer components may be included than those shown, two or more components may be combined, or a different configuration or arrangement of components may be provided. Fig.15 Three client computing devices are depicted, but any number of client computing devices may be supported in alternative embodiments.
[0265] The term "cloud service" is generally used to refer to services that are made available to users on demand by a service provider's system (e.g., cloud infrastructure system 1502) and via a communications network such as the Internet. Typically, in a public cloud environment, the servers and systems that make up the cloud service provider's system are different from the customer's own on-premises servers and systems. The cloud service provider's system is managed by the cloud service provider. Customers can therefore take advantage of cloud services provided by a cloud service provider without having to purchase separate licenses, support, or hardware and software resources for the services. For example, a cloud service provider's system can host applications, and users can order and use the applications on demand via the Internet without having to purchase infrastructure resources for executing the applications. Cloud services are designed to provide easy, scalable access to applications, resources, and services. Several providers offer cloud services. For example, Cloud Infrastructure, Inc. of Redwood Shores, California, offers cloud services. The company provides several cloud services such as middleware services, database services, Java cloud services, etc.
[0266] In some embodiments, the cloud infrastructure system 1502 may provide one or more cloud services using different models such as a software as a service (SaaS) model, a platform as a service (PaaS) model, an infrastructure as a service (IaaS) model, and other models including hybrid service models. The cloud infrastructure system 1502 may include a set of applications, middleware, databases, and other resources that enable the provision of various cloud services.
[0267] The SaaS model enables applications or software to be delivered to customers as a service over a communication network such as the Internet, without the customer having to purchase hardware or software for the underlying application. For example, the SaaS model can be used to provide customers with access to on-demand applications hosted by the cloud infrastructure system 1502. Examples of SaaS services provided by the Company include, but are not limited to, services for human resources / capital management, customer relationship management (CRM), enterprise resource planning (ERP), supply chain management (SCM), enterprise performance management (EPM), analytical services, social applications, and others.
[0268] The IaaS model is often used to provide infrastructure resources (eg, servers, storage devices, hardware, and networking resources) to customers as cloud services to provide elastic computing and storage capabilities. The company provides a variety of IaaS services.
[0269] The PaaS model is typically used to provide platform and environment resources as a service, which enables customers to develop, run, and manage applications and services without having to purchase, build, or maintain such resources. Examples of PaaS services provided by the Company include, but are not limited to, Oracle Java Cloud Service (JCS), Oracle Database Cloud Service (DBCS), Data Management Cloud Service, various application development solution services, and other services.
[0270] Cloud services are typically provided on an on-demand, self-service, subscription-based, elastically scalable, reliable, highly available, and secure basis. For example, a customer may order one or more services provided by the cloud infrastructure system 1502 via a subscription order. The cloud infrastructure system 1502 then performs processing to provide the services requested in the customer's subscription order. For example, the system 1502 may serve the analytical queries described in the present disclosure. The cloud infrastructure system 1502 may be configured to provide one or even multiple cloud services.
[0271] The cloud infrastructure system 1502 can provide cloud services via different deployment models. In a public cloud model, the cloud infrastructure system 1502 can be owned by a third-party cloud service provider, and the cloud services are provided to any general public customer, where the customer can be an individual or an enterprise. In certain other embodiments, under a private cloud model, the cloud infrastructure system 1502 can be operated within an organization (e.g., within an enterprise organization) and provide services to customers within the organization. For example, customers can be various departments of an enterprise, such as a human resources department, a payroll department, etc., or even individuals within an enterprise. In certain other embodiments, under a community cloud model, the cloud infrastructure system 1502 and the services provided can be shared by several organizations in a related community. Various other models can also be used, such as a hybrid of the models mentioned above.
[0272] Client devices 1504, 1506, and 1508 may be of different types (such as Fig.14 1404, 1406, and 1408) and may be capable of operating one or more client applications. A user may use a client device to interact with the cloud infrastructure system 1502, such as requesting services provided by the cloud infrastructure system 1502.
[0273] In some embodiments, the processing performed by cloud infrastructure system 1502 for providing cloud services may involve big data analysis. Such analysis may involve using, analyzing, and manipulating large data sets to detect and visualize various trends, behaviors, relationships, etc. within the data. The analysis may be performed by one or more processors, possibly processing data in parallel, performing simulations using the data, etc. The data used for the analysis may include structured data (e.g., data stored in a database or structured according to a structured model) and / or unstructured data (e.g., data blobs (binary large objects)).
[0274] As in Fig.15 As depicted in the embodiment of , cloud infrastructure system 1502 may include infrastructure resources 1530 for facilitating the provision of various cloud services provided by cloud infrastructure system 1502. Infrastructure resources 1530 may include, for example, processing resources, storage or memory resources, networking resources, and the like.
[0275] In some embodiments, to facilitate efficient provisioning of these resources to support the various cloud services provided by the cloud infrastructure system 1502 for different customers, the resources may be bundled into a collection of resources or resource modules (also referred to as a "pod"). Each resource module or cluster may include a pre-integrated and optimized combination of one or more types of resources. In some embodiments, different pods may be pre-provisioned for different types of cloud services. For example, a first collection of pods may be provisioned for a database service, a second collection of pods may be provisioned for a Java service, which may include a different combination of resources than the pods in the first collection of pods, and so on. For some services, the resources allocated to provision the service may be shared between services.
[0276] The cloud infrastructure system 1502 itself may internally use services 1532 that are shared by different components of the cloud infrastructure system 1502 and facilitate the service provisioning of the cloud infrastructure system 1502. These internally shared services may include, but are not limited to, security and identity services, integration services, enterprise repository services, enterprise manager services, virus scanning and whitelisting services, high availability, backup and recovery services, services for enabling cloud support, email services, notification services, file transfer services, and the like.
[0277] The cloud infrastructure system 1502 may include multiple subsystems. These subsystems may be implemented in software or hardware or a combination thereof. Fig.151502, the subsystems may include a user interface subsystem 1512 that enables users or customers of cloud infrastructure system 1502 to interact with cloud infrastructure system 1502. User interface subsystem 1512 may include a variety of different interfaces, such as a web interface 1514, an online store interface 1516 (where cloud services provided by cloud infrastructure system 1502 are advertised and available for purchase by consumers), and other interfaces 1518. For example, a customer may use a client device to request (service request 1534) one or more services provided by cloud infrastructure system 1502 using one or more of interfaces 1514, 1516, and 1518. For example, a customer may access an online store, browse cloud services provided by cloud infrastructure system 1502, and place a subscription order for one or more services provided by cloud infrastructure system 1502 to which the customer wishes to subscribe. The service request may include information identifying the customer and the one or more services to which the customer wishes to subscribe.
[0278] In some embodiments, such as Fig.15 In the embodiment shown in , cloud infrastructure system 1502 may include an order management subsystem (OMS) 1520 configured to process new orders. As part of this process, OMS 1520 may be configured to: create an account for a customer (if not already created); receive billing and / or accounting information from the customer, which will be used to bill the customer for providing the requested service to the customer; verify the customer information; after verification, book an order for the customer; and orchestrate various workflows to prepare the order for supply.
[0279] Once correctly confirmed, OMS1520 can call order provisioning subsystem (OPS) 1524, which is configured to provision resources for the order, including processing resources, memory resources, and networking resources. Provisioning can include allocating resources to the order, and configuring resources to facilitate the services requested by the customer order. The manner in which resources are provisioned for the order and the type of resources provided can depend on the type of cloud service that the customer has ordered. For example, according to a workflow, OPS1524 can be configured to determine the specific cloud service requested and identify multiple clusters that may have been pre-configured for the specific cloud service. The number of clusters allocated for the order can depend on the size / quantity / level / scope of the requested service. For example, the number of clusters to be allocated can be determined based on the number of users supported by the service, the duration of the service being requested, etc. The allocated clusters can then be customized for the specific requesting customer to provide the requested service.
[0280] Cloud infrastructure system 1502 can send a response or notification 1544 to the requesting client to indicate when the requested service is ready. In some cases, information (e.g., a link) can be sent to the client so that the client can begin to use and utilize the benefits of the requested service.
[0281] The cloud infrastructure system 1502 can provide services to multiple customers. For each customer, the cloud infrastructure system 1502 is responsible for managing information related to one or more subscription orders received from the customer, maintaining customer data related to the order, and providing the requested services to the customer. The cloud infrastructure system 1502 can also collect usage statistics about the customer's use of the subscribed services. For example, statistics can be collected for the amount of storage used, the amount of data transferred, the number of users, and the amount of system uptime and system downtime. This usage information can be used to bill the customer. Billing can be performed, for example, on a monthly cycle.
[0282] The cloud infrastructure system 1502 may provide services to multiple customers in parallel. The cloud infrastructure system 1502 may store information of these customers, including potentially proprietary information. In certain embodiments, the cloud infrastructure system 1502 includes an identity management subsystem (IMS) 1528 that is configured to manage the information of the customers and provide separation of the managed information so that information associated with one customer is not accessible to another customer. The IMS 1528 may be configured to provide various security-related services, such as identity services, such as information access management, authentication and authorization services, services for managing customer identities and roles and related capabilities, and the like.
[0283] Fig.16 An exemplary computer system 1600 is shown that can be used to implement certain embodiments. For example, in some embodiments, the computer system 1600 can be used to implement Figure 1A and Figure 1B Any system depicted in Fig.16 As shown in FIG. 1 , computer system 1600 includes various subsystems, including a processing subsystem 1604 that communicates with multiple other subsystems via a bus subsystem 1602. These other subsystems may include a processing acceleration unit 1606, an I / O subsystem 1608, a storage subsystem 1618, and a communication subsystem 1624. Storage subsystem 1618 may include non-transitory computer-readable storage media, including storage media 1622 and system memory 1610.
[0284] The bus subsystem 1602 provides a mechanism for enabling the various components and subsystems of the computer system 1600 to communicate with each other as desired. Although the bus subsystem 1602 is schematically shown as a single bus, alternative embodiments of the bus subsystem can utilize multiple buses. The bus subsystem 1602 can be any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a local bus using any of a variety of bus architectures, etc. For example, such architectures can include an industry standard architecture (ISA) bus, a microchannel architecture (MCA) bus, an enhanced ISA (EISA) bus, a video electronics standard association (VESA) local bus, and a peripheral component interconnect (PCI) bus, which can be implemented as a mezzanine bus manufactured according to the IEEE P1386.1 standard, etc.
[0285] The processing subsystem 1604 controls the operation of the computer system 1600 and may include one or more processors, application specific integrated circuits (ASICs), or field programmable gate arrays (FPGAs). The processor may include a single-core or multi-core processor. The processing resources of the computer system 1600 may be organized into one or more processing units 1632, 1634, etc. A processing unit may include one or more processors, one or more cores from the same or different processors, a combination of cores and processors, or other combinations of cores and processors. In some embodiments, the processing subsystem 1604 may include one or more dedicated coprocessors, such as a graphics processor, a digital signal processor (DSP), etc. In some embodiments, some or all of the processing subsystem 1604 may be implemented using custom circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs).
[0286] In some embodiments, the processing unit in the processing subsystem 1604 can execute instructions stored in the system memory 1610 or on the computer-readable storage medium 1622. In various embodiments, the processing unit can execute various programs or code instructions, and can maintain multiple concurrently executed programs or processes. At any given time, some or all of the program code to be executed may reside in the system memory 1610 and / or on the computer-readable storage medium 1622, including possibly on one or more storage devices. Through appropriate programming, the processing subsystem 1604 can provide the various functions described above. In the case where the computer system 1600 is executing one or more virtual machines, one or more processing units can be assigned to each virtual machine.
[0287] In certain embodiments, a processing acceleration unit 1606 may optionally be provided for performing customized processing or for offloading some of the processing performed by the processing subsystem 1604 , thereby speeding up the overall processing performed by the computer system 1600 .
[0288] I / O subsystem 1608 may include devices and mechanisms for inputting information to computer system 1600 and / or for outputting information from or via computer system 1600. In general, use of the term "input device" is intended to include all possible types of devices and mechanisms for inputting information to computer system 1600. User interface input devices may include, for example, keyboards, pointing devices such as a mouse or trackball, touch pads or touch screens incorporated into a display, scroll wheels, click wheels, dials, buttons, switches, keypads, audio input devices with voice command recognition systems, microphones, and other types of input devices. User interface input devices may also include software such as Microsoft Windows that enables a user to control and interact with input devices. Motion sensing and / or gesture recognition devices, Microsoft 360 game controllers, devices that provide an interface for receiving input using gestures and spoken commands. User interface input devices may also include eye gesture recognition devices, such as detecting eye activity from a user (e.g., a "wink" when taking a picture and / or making a menu selection) and translating eye gestures to input devices (e.g., Google ) Blink detector. In addition, the user interface input device may include a user to enable the user to communicate with the voice recognition system (e.g., Navigator) interactive voice recognition sensing device.
[0289] Other examples of user interface input devices include, but are not limited to, three-dimensional (3D) mice, joysticks or indicator rods, game pads and graphic tablets, and audio / video devices such as speakers, digital cameras, digital video cameras, portable media players, webcams, image scanners, fingerprint scanners, barcode readers 3D scanners, 3D printers, laser rangefinders, and eye gaze tracking devices. In addition, user interface input devices may include, for example, medical imaging input devices such as computed tomography, magnetic resonance imaging, position emission tomography, and medical ultrasound equipment. User interface input devices may also include, for example, audio input devices such as MIDI keyboards, digital musical instruments, etc.
[0290] In general, use of the term "output device" is intended to include all possible types of devices and mechanisms for outputting information from the computer system 1600 to a user or other computers. User interface output devices may include display subsystems, indicator lights, or non-visual displays such as audio output devices, etc. The display subsystem may be a cathode ray tube (CRT), a flat panel device such as one utilizing a liquid crystal display (LCD) or plasma display, a projection device, a touch screen, etc. For example, user interface output devices may include, but are not limited to, various display devices that visually convey text, graphics, and audio / video information, such as monitors, printers, speakers, headphones, car navigation systems, plotters, voice output devices, and modems.
[0291] Storage subsystem 1618 provides a repository or data repository for storing information and data used by computer system 1600. Storage subsystem 1618 provides a tangible, non-transitory computer-readable storage medium for storing basic programming and data constructs that provide the functionality of certain embodiments. Storage subsystem 1618 may store software (e.g., programs, code modules, instructions) that, when executed by processing subsystem 1604, provide the functionality described above. The software may be executed by one or more processing units of processing subsystem 1604. Storage subsystem 1618 may also provide a repository for storing data used in accordance with the teachings of the present disclosure.
[0292] The storage subsystem 1618 may include one or more non-transitory memory devices, including volatile and non-volatile memory devices. Fig.16 As shown in , the storage subsystem 1618 includes a system memory 1610 and a computer-readable storage medium 1622. The system memory 1610 may include multiple memories, including a volatile main random access memory (RAM) for storing instructions and data during program execution and a non-volatile read-only memory (ROM) or flash memory in which fixed instructions are stored. In some implementations, a basic input / output system (BIOS) containing basic routines that help transfer information between elements within the computer system 1600, such as during startup, may typically be stored in ROM. The RAM typically contains data and / or program modules currently operated and executed by the processing subsystem 1604. In some implementations, the system memory 1610 may include multiple different types of memory, such as static random access memory (SRAM), dynamic random access memory (DRAM), etc.
[0293] By way of example and not limitation, Fig.16As shown in FIG. 1 , system memory 1610 may load application programs 1612 being executed, which may include various applications (such as a web browser, a middle-tier application, a relational database management system (RDBMS)), program data 1614, and an operating system 1616. As an example, operating system 1616 may include various versions of Microsoft Apple and / or Linux operating system, various commercial or UNIX-like operating systems (including but not limited to various GNU / Linux operating systems, Google OS, etc.) and / or mobile operating systems such as Phone, OS, OS, OS operating system and other operating systems.
[0294] Computer-readable storage media 1622 may store programming and data structures that provide the functionality of some embodiments. Computer-readable storage media 1622 may provide storage for computer-readable instructions, data structures, program modules, and other data for computer system 1600. When executed by processing subsystem 1604, the software (programs, code modules, instructions) that provide the functionality described above may be stored in storage subsystem 1618. By way of example, computer-readable storage media 1622 may include non-volatile memory, such as a hard drive, a disk drive, a computer program such as a CD ROM, a DVD, (Blu-ray) disks or other optical media. Computer readable storage media 1622 may include, but are not limited to, Drive, flash memory card, universal serial bus (USB) flash drive, secure digital (SD) card, DVD disk, digital video tape, etc. The computer-readable storage medium 1622 may also include a solid-state drive (SSD) based on non-volatile memory (such as a flash memory-based SSD, an enterprise flash drive, a solid-state ROM, etc.), a volatile memory-based SSD (such as a solid-state RAM-based, dynamic RAM, static RAM, DRAM-based SSD, magnetoresistive RAM (MRAM) SSD), and a hybrid SSD using a combination of DRAM-based and flash memory-based SSDs.
[0295] In certain embodiments, storage subsystem 1618 may also include a computer-readable storage medium reader 1620, which may also be connected to computer-readable storage medium 1622. Reader 1620 may receive and be configured to read data from a memory device such as a disk, flash drive, or the like.
[0296] In some embodiments, computer system 1600 can support virtualization technology, including but not limited to virtualization of processing and memory resources. For example, computer system 1600 can provide support for executing one or more virtual machines. In some embodiments, computer system 1600 can execute programs such as hypervisors that promote the configuration and management of virtual machines. Memory, computing (e.g., processors, cores), I / O and networking resources can be allocated to each virtual machine. Each virtual machine is usually independent of other virtual machines. Virtual machines usually run their own operating system, which can be the same or different from the operating system executed by other virtual machines executed by computer system 1600. Therefore, computer system 1600 can potentially run multiple operating systems simultaneously.
[0297] The communication subsystem 1624 provides an interface to other computer systems and networks. The communication subsystem 1624 serves as an interface for receiving data from other systems and transmitting data from the computer system 1600 to other systems. For example, the communication subsystem 1624 can enable the computer system 1600 to establish a communication channel to one or more client devices via the Internet for receiving information from the client devices and sending information to the client devices.
[0298] The communication subsystem 1624 can support both wired and / or wireless communication protocols. For example, in some embodiments, the communication subsystem 1624 may include a radio frequency (RF) transceiver component, a global positioning system (GPS) receiver component, and / or other components for accessing a wireless voice and / or data network (e.g., using cellular telephone technology, advanced data network technology (such as 3G, 4G or EDGE (Enhanced Data Rates for Global Evolution), WiFi (IEEE 802.XX family of standards), or other mobile communication technologies, or any combination thereof). In some embodiments, the communication subsystem 1624 may provide a wired network connection (e.g., Ethernet) in addition to or in lieu of a wireless interface.
[0299] The communication subsystem 1624 may receive and transmit data in a variety of forms. For example, in some embodiments, the communication subsystem 1624 may receive incoming communications in the form of structured and / or unstructured data feeds 1626, event streams 1628, event updates 1630, etc., among other forms. For example, the communication subsystem 1624 may be configured to receive, in real time, incoming communications from users of a social media network and / or a user of a website such as feed, The data feed 1626 is received (or sent) by other communication services such as web feeds, updates, Rich Site Summary (RSS) feeds, and / or real-time updates from one or more third-party information sources.
[0300] In certain embodiments, the communication subsystem 1624 may be configured to receive data in the form of a continuous data stream that may be continuous or unbounded in nature and has no clear end, wherein the continuous data stream may include an event stream 1628 of real-time events and / or event updates 1630. Examples of applications that generate continuous data may include, for example, sensor data applications, financial quote machines, network performance measurement tools (e.g., network monitoring and traffic management applications), clickstream analysis tools, automotive traffic monitoring, etc.
[0301] The communication subsystem 1624 may also be configured to transmit data from the computer system 1600 to other computer systems or networks. The data may be transmitted in a variety of different forms (such as structured and / or unstructured data feeds 1626, event streams 1628, event updates 1630, etc.) to one or more databases that may communicate with one or more streaming data sources coupled to the computer system 1600.
[0302] Computer system 1600 may be one of various types, including a handheld portable device (e.g., Cellular phone, computing tablets, PDAs), wearable devices (e.g., Google head mounted display), personal computer, workstation, mainframe, kiosk, server rack, or any other data processing system. Due to the ever-changing nature of computers and networks, Fig.16 The description of the computer system 1600 depicted in FIG. 1 is intended to be a specific example only. Fig.16 Many other configurations of more or fewer components of the system depicted are possible. Based on the disclosure and teachings provided herein, a person of ordinary skill in the art will understand other ways and / or methods to implement the various embodiments.
[0303] Although specific embodiments have been described, various modifications, changes, alternative constructions, and equivalents are possible. For example, although certain examples have been described using SQL queries, this is not meant to be limiting. In alternative embodiments, the teachings described herein may also be applied to queries other than SQL queries. The embodiments are not limited to operations within certain specific data processing environments, but may be freely operated within multiple data processing environments. In addition, although certain embodiments have been described using a series of specific transactions and steps, it is obvious to those skilled in the art that this is not intended to be limiting. Although some flowcharts describe operations as sequential processing, many operations may be performed in parallel or simultaneously. In addition, the order of operations may be rearranged. The processing may have other steps not included in the figure. The various features and aspects of the above-described embodiments may be used alone or in combination.
[0304] In addition, although certain embodiments have been described using a particular combination of hardware and software, it should be appreciated that other combinations of hardware and software are also possible. Certain embodiments may be implemented using only hardware or only software or a combination thereof. The various processes described herein may be implemented on the same processor or on different processors in any combination.
[0305] Where a device, system, component or module is described as being configured to perform certain operations or functions, such configuration may be achieved, for example, by designing electronic circuits to perform the operations, by programming programmable electronic circuits (such as microprocessors) to perform the operations, such as by executing computer instructions or code, or a processor or core is programmed to execute code or instructions stored on a non-transitory storage medium, or any combination thereof to perform the operations. Processes may communicate using a variety of techniques, including but not limited to conventional techniques for inter-process communication, and different pairs of processes may use different techniques, or the same pair of processes may use different techniques at different times.
[0306] Specific details are given in this disclosure to provide a thorough understanding of the embodiments. However, embodiments may be practiced without these specific details. For example, well-known circuits, processes, algorithms, structures, and techniques have been shown without unnecessary details to avoid obscuring the embodiments. This description provides only example embodiments and is not intended to limit the scope, applicability, or configuration of other embodiments. Rather, the previous description of the embodiments will provide an enabling description for implementing various embodiments for those skilled in the art. Various changes may be made to the functions and arrangements of the elements.
[0307] Therefore, the description and drawings should be regarded as illustrative rather than restrictive. However, it will be apparent that additions, subtractions, deletions and other modifications and changes may be made thereto without departing from the broader spirit and scope set forth in the claims. Therefore, although specific embodiments have been described, these embodiments are not intended to be limiting. Various modifications and equivalents are within the scope of the appended claims.
Claims
1. A method for generating an enhanced query plan, comprising: receiving, by a computing system, an original query plan generated for a query for querying data stored in a relational database, the original query plan comprising a first fact scanning operation configured to scan fact records from a source of fact records, the original query plan further comprising a second operation configured to receive a record set from the first fact scanning operation; identifying, by the computing system, a first dimension context predicate condition to be associated with a first fact scan operation, wherein the first dimension context predicate condition corresponds to a first fact scan operation in an enhanced query plan configured to scan facts in one or more records of a source of the fact records; as well as The computing system rewrites the original query plan to generate the enhanced query plan, wherein in the enhanced query plan, the first dimension context predicate condition is associated with the first fact scanning operation, and the second operation receives only the one or more scanned fact records that satisfy the first dimension context predicate condition, Among them, due to the association of the first dimension context predicate condition with the first fact scanning operation, the enhanced query plan is executed faster than the original query plan. The method of claim 1 , wherein the data used for querying is non-pre-aggregated data.
3. The method according to claim 1 or 2, further comprising: executing the enhanced query plan to obtain a result record set for the query; as well as Provides a result recordset in response to a query.
4. The method according to claim 1 or 2, wherein: Executing the enhanced query plan takes fewer central processing unit (CPU) cycles than executing the original query plan.
5. The method according to claim 1 or 2, wherein: The number of fact records received and processed by the second operation in the enhanced query plan is less than the number of fact records received and processed by the second operation in the original query plan.
6. The method of claim 1 or 2, wherein the identifying a first dimension context predicate condition to be associated with the first fact scanning operation comprises: identifying a first fact scan operation in the original query plan, the first fact scan operation operating on a first fact table; as well as Starting with a first fact scan operation, an original query plan is traversed to identify a list of one or more applicable dimension context predicate conditions for the first fact scan operation, the list of one or more applicable dimension context predicate conditions including the first dimension context predicate condition.
7. The method of claim 1 or 2, wherein the identifying a first dimension context predicate condition to be associated with the first fact scanning operation comprises: identifying a first fact scan operation operating on a first fact table in an original query plan; identifying a second fact scan operation that operates on a second fact table in the original query plan; identifying a join operation between a second fact table and a dimension table in the original query plan, wherein the first dimension context predicate condition is associated with the dimension table; as well as identifying a common dimension between the first fact table and the second fact table; and Where the first dimension context predicate condition is based on attributes from the common dimension.
8. The method of claim 1 or 2, wherein the identifying a first dimension context predicate condition to be associated with the first fact scanning operation comprises: identifying a plurality of dimensional contextual predicate conditions applicable to a first fact scanning operation; calculating a net benefit measure for each of the plurality of dimensional context predicate conditions, wherein the net benefit measure for a dimensional context predicate condition of the plurality of dimensional context predicate conditions is a measure of a reduction in a cost of processing a fact row from a source of fact records minus a cost of applying the dimensional context predicate condition to a first fact scan operation; sorting the plurality of dimensional contextual predicate conditions for a first fact scanning operation based on a net benefit metric calculated for the plurality of dimensional contextual predicate conditions; as well as Based on the ranking, a dimensional context predicate condition to be associated with a first fact scan operation is selected from the plurality of dimensional context predicate conditions.
9. The method of claim 1 or 2, wherein the identifying a first dimension context predicate condition to be associated with the first fact scanning operation comprises: identifying applicable dimension context predicate conditions for a first fact scan operation; calculating a net benefit measure for said applicable dimensional context predicate condition; determining, based on a net benefit metric calculated for the applicable dimensional context predicate condition, that the applicable dimensional context predicate condition is not to be associated with a first fact scanning operation; as well as A first dimensional contextual predicate condition is inferred from the applicable dimensional contextual predicate conditions using functional dependency information.
10. The method of claim 1 or 2, wherein the source of the fact record is a table storing the fact record, a materialized view, or an online analytical processing (OLAP) index.
11. The method of claim 1 or 2, further wherein identifying the first dimension context predicate condition comprises: A third operation in the original query plan is identified, wherein the first dimension context predicate condition is associated with the third operation. The method of claim 11 , wherein the third operation is associated with a dimension table.
13. The method of claim 1 or 2, wherein identifying the first dimension context predicate condition comprises: identifying a second dimension context predicate condition to be associated with the first fact scanning operation; as well as The second dimension context predicate condition is transformed into the first dimension context predicate condition. 14 . The method of claim 13 , wherein the converting comprises converting the second dimension context predicate condition into the first dimension context predicate condition using functional dependency information.
15. The method of claim 13, wherein the second dimension context predicate condition specifies a value for a first dimension field, and the first dimension context predicate condition specifies a value for a second dimension field different from the first dimension field, wherein the second dimension field is a column field in a dimension table or in a source of a fact record.
16. The method of claim 1 or 2, further comprising: identifying a first sub-plan in the original query plan, the first sub-plan comprising a first fact scan operation, wherein the first sub-plan comprises only one or more of an aggregation, a join, a projection, a filter, or a fact scan operation; and The enhanced query plan includes a first sub-plan having a first dimension context predicate condition associated with a first fact scan operation.
17. The method of claim 1 or 2, further comprising: Based on the star schema, determine the source of the fact record to be able to join with the dimension table; as well as Wherein the first dimension context predicate condition includes a condition related to a dimension key in a dimension table to be joined with a source of the fact record.
18. The method of claim 1 or 2, wherein: The source of the fact record is an OLAP index, which includes a table and an index that indexes dimension values in the table; The table includes data generated by joining a fact table storing fact records with a dimension table including dimension values; as well as The first dimension context predicate condition is evaluated against the dimension values in the OLAP index.
19. A non-transitory computer readable memory storing a plurality of instructions executable by one or more processors, the plurality of instructions comprising instructions that, when executed by the one or more processors, cause the one or more processors to perform a process, the process comprising: receiving an original query plan generated for a query for querying data stored in a relational database, the original query plan comprising a first fact scanning operation configured to scan fact records from a source of fact records, the original query plan further comprising a second operation configured to receive a record set from the first fact scanning operation; identifying a first dimension context predicate condition to be associated with a first fact scan operation, wherein the first dimension context predicate condition corresponds to a first fact scan operation in an enhanced query plan configured to scan facts in one or more records of a source of the fact records; as well as rewriting the original query plan to generate an enhanced query plan, wherein, in the enhanced query plan, a first dimension context predicate condition is associated with the first fact scanning operation, and the second operation receives only those one or more scanned fact records that satisfy the first dimension context predicate condition; executing the enhanced query plan to obtain a result record set for the query, wherein the enhanced query plan executes faster than the original query plan due to the association of the first dimension context predicate condition with the first fact scan operation; and Provides a result recordset in response to a query.
20. A system for generating an enhanced query plan, comprising: one or more processors; as well as a memory coupled to the one or more processors, the memory storing a plurality of instructions executable by the one or more processors, the plurality of instructions comprising instructions that, when executed by the one or more processors, cause the one or more processors to perform a process comprising: receiving an original query plan generated for a query for querying data stored in a relational database, the original query plan comprising a first fact scanning operation configured to scan fact records from a source of fact records, the original query plan further comprising a second operation configured to receive a record set from the first fact scanning operation; identifying a first dimension context predicate condition to be associated with a first fact scan operation, wherein the first dimension context predicate condition corresponds to a first implemented scan operation in an enhanced query plan configured to scan facts in one or more records of a source of the fact records; and rewriting the original query plan to generate an enhanced query plan, wherein, in the enhanced query plan, a first dimension context predicate condition is associated with the first fact scanning operation, and the second operation receives only those one or more scanned fact records that satisfy the first dimension context predicate condition; executing the enhanced query plan to obtain a result record set for the query, wherein the enhanced query plan executes faster than the original query plan due to the association of the first dimension context predicate condition with the first fact scan operation; and Provides a result recordset in response to a query.
Citation Information
Patent Citations
Multi-fact query processing in data processing system
US20130173528A1
Framework for Visualizing Re-Written Queries to Database
US20150370865A1
Using overlapping partitions of data for query optimization
US6014656A
