Multipass Prefix Sorting for Faster Query Processing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing sort operators in query processing engines are slow and inefficient, particularly when handling out-of-order data, which significantly impacts query response time and cost.

Innovation Solution

A hybrid sort algorithm that adaptively combines multiple sort algorithms, such as MSB radix sort, TimSort, and merge sort, based on input data characteristics, and utilizes a binary merge tree for large datasets, employing in-cache sorting and prefix-based sorting for efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a single sort algorithm is used, then the implementation is simple, but the sorting performance is slow (2-5× slower than hybrid sort)

Engineering Contradiction:
Improvesorting performanceVSAvoidalgorithm complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent combines multiple sort algorithms (radix sort, TimSort, merge sort) into a hybrid sort operator that adaptively selects and executes appropriate algorithms based on data characteristics. This merging of algorithms resolves the contradiction by achieving superior sorting performance through algorithm combination while managing complexity through adaptive selection rather than implementing all algorithms unconditionally.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The sort operator dynamically adapts its behavior by selecting different sort algorithms based on input data characteristics such as data size, distribution, and type. This dynamic adaptation allows the system to optimize sorting performance for different scenarios without being locked into a single algorithm, resolving the contradiction between simplicity and performance.

Inventive Principle:
Principle #15Dynamics

2Productivity

If a hybrid sort algorithm combining multiple algorithms is used, then the sorting performance is improved (2-5× faster), but the algorithm complexity increases

Engineering Contradiction:
Improvesorting speedVSAvoidalgorithm structure
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The hybrid sort operator uses dynamic adaptation to select appropriate algorithms based on data characteristics. By making the algorithm selection dynamic rather than static, the system achieves high performance for diverse data types and sizes while managing complexity through condition-based routing rather than monolithic implementation.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system changes operational parameters by selecting different algorithms based on data characteristics such as size thresholds, distribution patterns, and data types. This parameter-based algorithm selection enables the system to optimize performance for specific scenarios while keeping the overall structure manageable through clear decision boundaries.

Inventive Principle:
Principle #35Parameter changes

3Loss of time

If traditional sort algorithms are used for large datasets, then the implementation is straightforward, but the query processing time increases significantly

Engineering Contradiction:
Improvequery processing timeVSAvoidsort implementation
Core Design Contradiction:
Loss of timeVSDevice complexity

Solution Approach 1:

The patent segments the sorting process into multiple passes, where each pass handles a portion of the data or a specific aspect of sorting. This segmentation enables parallel processing and reduces the time required to sort large datasets by dividing the workload into manageable chunks that can be processed concurrently.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary sorting actions in earlier passes to organize data before final sorting is completed. By doing preliminary work upfront, the system reduces the complexity of subsequent sorting operations and overall query processing time for large datasets.

Inventive Principle:
Principle #10Preliminary action

4Productivity

If multiple sort algorithms are adaptively combined, then the sorting efficiency is optimized for different data types and sizes, but the system complexity increases

Engineering Contradiction:
Improvesorting efficiencyVSAvoidsystem architecture
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The hybrid sort operator is designed as a universal component that can handle multiple data types and sizes by adaptively selecting appropriate algorithms. This multi-functionality is achieved through a unified operator structure that incorporates multiple algorithms, allowing a single operator to serve diverse sorting needs without requiring separate specialized operators for each scenario.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS12530334B1Multiple pass sort
Publication Date: 2026.01.20 DATABRICKS INC
  • US12530334B1 patent drawing
  • US12530334B1 patent drawing
  • US12530334B1 patent drawing

AI summary

A system for multipass sort includes a communication interface and a processor. The communication interface is configured to receive from a client device a request to sort a dataset that includes a plurality of rows. The processor is configured to perform a first sort pass on the dataset in part by: extracting prefixes associated with a first schema element associated with the dataset for the plurality of rows; and sorting the extracted prefixes utilizing an integer sort algorithm based on a sort order included in the request to sort the dataset, where sorting the extracted prefixes includes utilizing NULL values to resolve a tied range that includes at least two rows of the plurality of rows having a same extracted prefix.