databendlabs / databend

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

refactor(query): sort kernel optimization #16458

Closed sundy-li closed 1 month ago

sundy-li commented 2 months ago

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

Summary

  1. Introduce ColumnVisitor trait and SortCompare
  2. Optimize kernel sort performance (Now we are using column vertical sort, which removes virtual call in sort compare functions)

Sort Performance with 2~3 order column test example, gain about 40%~50%

select l_partkey, l_returnflag from (select * from tpch_test.lineitem limit 10000000) order by l_partkey desc, l_returnflag asc ignore_result;

Tests

Type of change


This change isโ€‚Reviewable