Tidb: Improve the performance of `WindowExec` by using sliding window or segment tree

Created on 28 Oct 2019  路  20Comments  路  Source: pingcap/tidb

Description

TiDB implements window function feature compatible with MySQL (https://dev.mysql.com/doc/refman/8.0/en/window-functions.html). The performance has much space to improve.

Considering implementing an algorithm of sliding window or segment tree within the different frames of the same window partition, when doing the aggregate calculation step.

And here鈥檚 a paper to read http://www.vldb.org/pvldb/vol8/p1058-leis.pdf for reference, describing and comparing some effective implementations. A paper reading video (in Chinese) is here(https://www.bilibili.com/video/av70860233). Due to this paper, we have a chance to make a SQL like select sum(a) over (order by b rows between ? preceding and current row) from r; 600% faster.

Goals:

  • Implement an algorithm of sliding window or segment tree within the different frames of the same window partition

Score

  • 3000

Mentor(s)

  • @SunRunAway

Recommended Skills

  • SQL Optimization
  • Golang Profiling
  • Code Refactoring

PRs

Framework: https://github.com/pingcap/tidb/pull/14294

challenge-program difficultmedium high-performance siexecution typenhancement

Most helpful comment

It seems all issues of this sliding window optimization have been completed 馃帄 !
Can we close this issue now? @SunRunAway @mmyj

All 20 comments

/pick-up-challenge

@mmyj don't have enough score, pick up failed
Progress 0/400
You may pick up some easy issues first.

/pick-up-challenge

@mmyj pick up issue success

/pick-up

avg

Pick up success.

/pick-up

avg

hi, the slide window interface of the avg aggFunc had been implemented.@vagetablechicken

@SunRunAway please update the todo list, I had been compelated the avg and the xor.

/pick-up
group_concat

This issue already picked by vagetablechicken.

/pick-up
bitxor

This issue already picked by vagetablechicken.

/give-up

ok, give up this issue

Give up success.

Maybe individual issue should be created for each item. Otherwise the issues could not be picked up.

/pick-up

Pick up success.

@TszKitLo40
Thanks for the reminder.
I've updated the progress in the description, this is only one subtask remained which is working in progress. Thus we'll not create new issues for the sub-tasks.

It seems all issues of this sliding window optimization have been completed 馃帄 !
Can we close this issue now? @SunRunAway @mmyj

@mmyj You did not submit PR within 7 days, so give up automatically.

Was this page helpful?
0 / 5 - 0 ratings