Database Query Optimizer Skew Detection and Redistribution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Massively parallel database engines face inefficiencies due to data skew during join operations, where current approaches either ignore skewing effects or require costly duplication of smaller spool files across all nodes, leading to processing imbalances and performance issues.

Innovation Solution

A method for dynamically detecting excessive data skew at query execution time, using a skew threshold to determine when to employ join skew avoidance steps, which involves creating a temporary table with skewed values and partitioning factors to redistribute rows across processing modules, thereby mitigating processing inefficiencies without duplicating entire tables.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If data skew is ignored during join operations, then query processing is simpler and faster, but processing balance deteriorates and performance issues occur

Engineering Contradiction:
Improvequery processing speedVSAvoidprocessing balance
Core Design Contradiction:
ProductivityVSEase of operation

Solution Approach 1:

The system performs preliminary detection of data skew at query execution time by calculating frequency distributions for join columns. Before executing the join operation, the optimizer identifies skewed values and prepares redistribution strategies, allowing the system to address skewing issues proactively rather than reactively, thus maintaining both processing speed and balance.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system dynamically adjusts the join execution strategy based on detected data skew characteristics. Instead of using a fixed join approach, the optimizer adapts the query plan by inserting skew avoidance steps when skew is detected, creating a flexible system that can switch between different processing modes (standard join vs. skew-aware join) based on runtime conditions.

Inventive Principle:
Principle #15Dynamics

2Ease of operation

If the smaller spool file is duplicated on all nodes to handle skew, then processing balance improves, but memory costs increase significantly

Engineering Contradiction:
Improveprocessing balanceVSAvoidmemory usage
Core Design Contradiction:
Ease of operationVSQuantity of substance

Solution Approach 1:

Instead of uniformly duplicating the smaller spool file across all nodes, the system applies local quality by identifying specific skewed values and their frequency distributions. The redistribution strategy is tailored to local skew characteristics, replicating only the necessary portions of data on specific nodes where they are needed, rather than a blanket duplication approach.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The system performs partial action by duplicating only the skewed portions of the smaller spool file rather than the entire file. By calculating frequency distributions and identifying skewed values, the system replicates only the necessary data segments on relevant nodes, reducing memory overhead while still achieving processing balance.

Inventive Principle:
Principle #16Partial or excessive action

3Ease of operation

If dynamic skew detection and mitigation steps are inserted into the query plan, then processing balance improves, but query complexity increases

Engineering Contradiction:
Improveprocessing balanceVSAvoidquery plan complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The system implements self-service by automatically detecting data skew and generating appropriate mitigation strategies without requiring user intervention. The query optimizer autonomously calculates frequency distributions, identifies skewed values, and inserts skew avoidance steps into the query plan, making the system self-aware and self-correcting regarding data skew issues.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system uses feedback by calculating frequency distributions of join column values and using this information to adjust the query execution plan. The detected skew characteristics feed back into the optimizer, which then modifies the join strategy accordingly, creating a closed-loop system that adapts based on runtime data characteristics.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS8078610B2Optimization technique for dealing with data skew on foreign key joins
Publication Date: 2011.12.13 TERADATA CORP
  • US8078610B2 patent drawing
  • US8078610B2 patent drawing
  • US8078610B2 patent drawing

AI summary

A method for determining when a database system query optimizer should employ join skew avoidance steps. The method includes dynamically calculating the worst-case anticipated frequency distribution for a particular relation along a particular set of join column(s) at query execution time. The calculated frequency distribution value is compared to a skew threshold, the skew threshold representing the number of rows on the same distinct value that would lead to avoidable processing inefficiencies. It is then determined that the database system query optimizer should employ join skew avoidance steps if the calculated frequency distribution value exceeds the skew threshold.