Kaushik Rajan on Accelerating Scalar Functions in SQL using a retargetable compiler
202508291336
Status: #idea
Tags: Microsoft Research
Kaushik Rajan on Accelerating Scalar Functions in SQL using a retargetable compiler
- Project DataHotRod → GPU accelerated SQL engine (Currently in private beta for customers)
- Tensor Query Processing
- HTs, Joins, etc. can be done on TPUs
- This talk talks about scalar functions in SQL
Introduction to Scalar Functions
- Transform every value in a column
- Majority of production workloads use
- Some categories
- Type conversion (CAST, COALESCE, CONVERT, PARSE)
- String functions
- Date and time functions
- Math and logical functions
- Query with scalar is 3x more expensive than one without scalar
- Ref: Query from TPC-H
Contribution
- Main thing we notice is that the starting point for this complier is the C++ code and not the SQL function itself
- Vectorizers struggle with while loops. They make optimizations which allow you to run while loops in parallel, and it handles data dependencies. We wait till all elements of the vector exit, before terminating, and then perform a reduction step.