OLAP Join Cardinality Estimation via Factor Graphs

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing data query methods in large-scale online analytical processing (OLAP) systems face challenges in accurately estimating the join cardinality due to complex correlations and highly skewed distributions of join key values, leading to low precision in query optimization.

Innovation Solution

A data query method based on online analytical processing that constructs a factor graph from target join keys in a structured query statement, using factor nodes to represent conditional probability distributions, and estimates an upper limit value of the join cardinality using this graph.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional join cardinality estimation methods are used, then the query optimization process is simple, but the precision of join cardinality estimation is low due to complex correlations and highly skewed distributions of join key values

Engineering Contradiction:
Improvejoin cardinality estimation precisionVSAvoidquery optimization complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the join cardinality estimation problem into multiple independent steps: (1) obtaining filtered value ranges for each join key from query conditions, (2) calculating selection ratios based on histograms and value ranges, (3) computing intermediate join cardinalities using selection ratios, and (4) determining the final join cardinality through iterative optimization. This segmentation allows each step to be processed independently, improving precision while managing complexity through structured computation.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary actions by pre-computing histograms for each join key and storing value distribution statistics before the actual query execution. During query optimization, these pre-computed histograms are directly utilized to calculate selection ratios and join cardinalities, eliminating the need for complex real-time distribution analysis and reducing the computational burden during query processing.

Inventive Principle:
Principle #10Preliminary action

2Measurement precision

If complex probability distribution models are used to improve estimation precision, then the accuracy of join cardinality estimation improves, but the computational overhead increases

Engineering Contradiction:
Improvejoin cardinality estimation accuracyVSAvoidquery optimization time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent uses lightweight histogram data structures that are inexpensive to compute and store, replacing complex probability distribution models. The histograms are computed once during data loading and discarded after query optimization, providing accurate value distribution information without the computational overhead of maintaining complex statistical models during query execution.

Inventive Principle:
Principle #27Cheap short-living objects (Disposable)

Solution Approach 2:

The patent computes selection ratios and join cardinalities for only the relevant join keys involved in the current query, rather than analyzing the entire dataset or all possible join combinations. This partial computation approach focuses resources on the specific query requirements, reducing unnecessary computational overhead while maintaining estimation accuracy for the queried join operations.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS20250036624A1Data query method based on online analytical processing, medium, and device
Publication Date: 2025.01.30 BEIJING VOLCANO ENGINE TECH CO LTD
  • US20250036624A1 patent drawing
  • US20250036624A1 patent drawing

AI summary

The present disclosure relates to a data query method and apparatus based on online analytical processing, a medium, and a device. The method includes: obtaining a plurality of target join keys between query tables in a structured query statement in response to reception of the structured query statement; constructing a first factor graph corresponding to the structured query statement based on the plurality of target join keys, where a factor node in the first factor graph is used to represent a conditional probability distribution in the case of presence of the target join keys in a query table corresponding to the factor node; and estimating an upper limit value of a join cardinality of the structured query statement based on the first factor graph.