I've been restoring a lot of dump files to mysql, but I keep getting Waiting for table flush.

Asked 1 years ago, Updated 1 years ago, 35 views

Hello
I'm restoring a large number of sql files (about 300MB per file) to mysql, but when I do the show process list, I sometimes see an insert statement and then I keep seeing Waiting for table flush. What is this doing inside?
Are you writing to the table?

mysql

2022-09-30 18:21

1 Answers

As you said, I think we are waiting to write to the database. It depends on how you write the sql statement, but if you try to run a large sql file, you will have mysql keep all of the changes in memory. Flush is the operation of writing all the data that has been stored in memory to disk.This could be quite slow, for example, on a system that is using a swap, and if this operation is already involved in the swap.This is because the task of writing all the memory content to disk is to read it out of the swap and rewrite it to disk, and the task of copying large files itself is likely to take time at any time.

For your information, flush refers to the task of perpetuating the contents of a database on its memory to disk to allow it to recover even if it is powered off.

If you feel uncomfortable with the performance of the database, like this one, you must first determine the cause. If you are using Linux,

vmstat1

The displays metrics related to system performance every second.

According to the comment, it was solved by increasing the memory, but if you tried running vmstat1, you would have recognized it as an increase in si/so (swap-in-swap-out kb).


2022-09-30 18:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.