Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 但表很大时tidb不断的重启
【TiDB Usage Environment】Test environment
【TiDB Version】
6.1
【Encountered Problem】
【Reproduction Path】What operations were performed to cause the problem
【Problem Phenomenon and Impact】
Table object with 2 billion records. Users continuously update and delete, causing the tidb-server to keep restarting. Even with memory increased to 256GB, it cannot start normally.
【Attachments】
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.
Can you provide information on the scope of update and delete transactions? For example, how many records need to be processed at one time, etc.
Are there any OOM errors?
Is the amount of data modified by a single transaction too large? It is recommended to split the transaction or set a maximum memory usage threshold for the statement.
It’s normal to keep updating. Here, I need to ask, are you operating on 2 billion rows each time?
Check the Dashboard to see if you can find slow SQL, large result sets, and large transaction SQL.
Analyze the UPDATE and DELETE statements.
Generally, the conditions for update and delete should use indexes, then control the scan range of the conditions, and handle a few million rows at a time.
Delete the entire table and insert the entire table.
512GB of memory is used up, then OOM, and it keeps looping like this.
Large transactions in the TP database have many complications; it is recommended to reduce the transaction size.
It’s not quite appropriate, this kind of operation…
But, it’s just a test, so just play around.
Checking the large table once a day should be sufficient.
Large table loop queries can execute thousands of queries per second. These developers lack SQL experience. Should we limit the frequency? Each execution takes only about 3ms.
This topic was automatically closed 1 minute after the last reply. No new replies are allowed.