-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
tidb_batch_insert should not hit executor OOM quota #20597
Comments
@jackysp PTAL, thanks! |
@cfzjywxk PTAL |
Sorry for the late reply. I think we forget to Consume the transaction size when finishing one batch. |
Please edit this comment to complete the following informationBugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)Forget to Consume the transaction size when finishing one batch. 2. Symptom (optional)
3. All Trigger Conditions (optional)Use 4. Workaround (optional)5. Affected versions6. Fixed versionsmaster |
( AffectedVersions ) fields are empty. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
My understanding of
tidb_batch_insert
is that it is not documented intentionally. I think there is a valid use case for incrementally committing data however. See: #18038This bug report is about
tidb_batch_insert
. Consider the following sample data:If I use the MySQL command line client, I can select 1 billion rows with:
(The
--quick
option is required to prevent a client OOM. It retrieves one row at a time from the server.)The memory for the above query remains stable, as observed in both
top
and inselect * from information_schema.processlist
:However, if I set
enable-batch-dml = true
in my tidb.toml file and attempt to execute this same query as anINSERT .. SELECT
I reach query OOM. This is despite settingtidb_dml_batch_size=20000
+tidb_batch_insert=1
:Output:
During this time, I can see the memory growing at a constant rate:
2. What did you expect to see? (Required)
Because the
tidb_dml_batch_size
is 20K, I expect the memory usage to be stable as TiDB continues to incrementally commit.The expected result is that this query should be able to run for however long it takes to insert 1B rows.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: