-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window function causes tidb-server OOM #18444
Comments
from the profile, and the analyze output of limited tuples, we see the scan operator occupy a lot of memory. After increasing the concurrency of related operators and decreasing the concurrency of scan, the query with window function does not OOM. |
@fzhedu Could you locate which line of code consumes the memory in |
I saw a similar case here #16104 (comment), and it may be the same problem and we should modify this channel to resolve the root cause. Could you help reconfirm that they're the same problem? |
The other problem is that the window executor holds one window partition into memory before calculating. With this SQL, it holds the whole table in memory because the whole table is one partition. We may consider reimplementing window executor in a pipeline manner. |
There are two problems in this issue.
I think this problem can be considered solved at present, so I close the issue now. Feel free to re-open this issue if needed. |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
Description
my table has 1 billion records, when I execute a paging query over the full table data by using the window function, it causes the tidb-server OOM (this tidb-server has 96G RAM to use). So I re-wrote the window function to the user variable query, it could get a result set in 18 minutes, with less than 1G RAM usage.
schema:
window fucnction:
select min(t.cuno) as start_key, max(t.cuno) as end_key, count(*) as page_size from (select *, row_number() over(order by cuno) as row_num from account) t group by floor((t.row_num-1)/10000000) order by start_key;
user variable:
Query plans:
SIG slack channel
#sig-exec
Score
Mentor
The text was updated successfully, but these errors were encountered: