databendlabs / databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.71k stars 732 forks source link

feat: add fast path for cross join to optimize tpcds q23 (~50x) #16504

Closed xudong963 closed 2 days ago

xudong963 commented 2 days ago

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Note: tpcds 1GB. Local machine M1 mac, 8c 32GB

This PR adds a fast path for cross join when build side only has a row, which matches tpcds q23's pattern(build side is from a max/sum agg).

By the fast path, we can avoid memory reallocation. Then reduce cache miss and improve the ability of SIMD for next operators.

Before: 26s

image

Now: 0.4s img_v3_02f0_b8e12fc1-0406-40c7-a18b-cd80033e426g

Tests

Type of change


This change isโ€‚Reviewable