INSERT Statement OOM

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: insert语句OOM

| username: 花匠小林

[TiDB Usage Environment] Testing
[TiDB Version] v7.1.1
[Reproduction Path] Batch insert 500 records into a single table
[Encountered Problem: Phenomenon and Impact]
An error occurs when executing the insert statement in the program, indicating that a single SQL exceeds the memory limit (1G). However, when executing the SQL from the log separately, it executes normally, and the memory usage is only 1.8M.
I would like to ask why the insert statement executed in the program consumes so much memory? How should I analyze this?

[Resource Configuration]

[Attachments: Screenshots/Logs/Monitoring]
Memory information at that time:

Related error logs of TiDB when the program is running:

Memory information when executing the SQL separately:

Memory parameter configuration in TiDB:

| username: Fly-bird | Original post link

Is there a transaction being executed? Is it being executed within the program?

| username: xfworld | Original post link

Mixed deployment, a bit challenging…

| username: TiDBer_小阿飞 | Original post link

Is this the only SQL statement in the program?

| username: 花匠小林 | Original post link

Yes, there is a transaction. However, if the number of single inserts is modified to 100, this issue does not occur.

| username: 花匠小林 | Original post link

This statement is within a transaction, but in the same transaction, modifying the number of writes to 100 entries at a time does not produce this error. Moreover, isn’t this limit supposed to apply to a single SQL statement?

| username: 花匠小林 | Original post link

I misunderstood, thank you for the reminder.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.