Compile-Time Encoding Inference for Database Vectorization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems face complications in dealing with different encodings at runtime, which hinders efficient vectorization and leads to performance penalties due to decoding/re-encoding operations, especially when handling constants.
Innovation Solution
Implementing compile-time encoding-type inference and using a transcode operator to decouple encoding inference from data-type checking, allowing encoding matching to occur at compile-time rather than runtime, thereby simplifying operator code and improving performance.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If different encoding types are supported for the same data type at runtime, then data representation flexibility is improved, but operator code complexity increases significantly
Solution Approach 1:
The patent applies preliminary action by performing encoding-type inference at compile-time rather than runtime. The system infers and determines the appropriate encoding-type for each expression tree node before query execution, storing this information in the compiled query plan. This eliminates the need for complex runtime encoding checks and conversions, as the encoding-type is already determined and baked into the execution plan, thus resolving the contradiction between supporting multiple encodings and maintaining simple operator code.
2Adaptability or versatility
If multiple encodings are handled at runtime, then data type versatility is improved, but vectorization efficiency deteriorates
Solution Approach 1:
The patent resolves this contradiction by performing encoding-type inference at compile-time, determining the specific encoding-type for each node in the expression tree before vectorization occurs. The compiled query plan includes this encoding information, allowing the vectorized execution engine to operate on data with known, consistent encodings without runtime checks or conversions, thus maintaining both versatility and high vectorization efficiency.
3Reliability
If encoding matching is performed at runtime, then correctness is improved, but execution performance deteriorates due to decoding/re-encoding operations
Solution Approach 1:
The patent applies preliminary action by performing encoding-type inference and matching at compile-time, determining the correct encoding-type for each expression tree node and propagating this information through the query plan. The compiled execution plan includes this encoding information, eliminating the need for runtime decoding and re-encoding operations. This ensures correctness is maintained while avoiding performance penalties, as the encoding matching is completed during compilation rather than during data processing.
4Ease of operation
If constants are applied with arbitrary encodings, then ease of operation is improved, but performance deteriorates due to unnecessary decoding/re-encoding
Solution Approach 1:
The patent applies parameter changes by inferring and setting the encoding-type parameter for constants at compile-time based on the context in which they are used in the query. Rather than allowing arbitrary encodings or requiring runtime determination, the system determines the appropriate encoding-type for each constant during compilation and bakes this into the execution plan, eliminating unnecessary decoding and re-encoding operations while maintaining ease of use.
Data Source
AI summary
Techniques are described herein for introducing transcode operators into a generated operator tree during query processing. Setting up the transcode operators with correct encoding type at runtime is performed by inferring correct encoding type information during compile time. The inference of the correct encoding type information occurs in three phases during compile time: the first phase involves collecting, consolidating, and propagating the encoding-type information of input columns up the expression tree. The second phase involves pushing the encoding-type information down the tree for nodes in the expression tree that do not yet have any encoding-type assigned. The third phase involves determining which inputs to the current relational operator need to be pre-processed by a transcode operator.


