How to deal with mySQL disk full?

I have a flow that insert data into mySQL. But I am afraid what will happened if the disk is full.
I can't find any setting inside the mySQL workbench. (pls let me know if I can set anything.)

  1. My plan is to use node-red to keep reading the total number of rows, and if it is above 100M rows, then, delete the last 10k rows. But the return will be slow and use lots of computation time.

  2. My another plan is to use Influx, but I have to rebuild the data.

Is there any better suggestion? thx

Why do you think it will take a long time to delete rows? This is a fairly bread and butter stuff for a database. Just be sure you have an index on the column you use in the where clause to prevent a full table scan.

You could poll on a suitable basis (like every hour or during known quiet times) and select count(id) - if the value is > 100000, the run a delete/where query. Doesn't need to be 10000. Could be as few as 100 or 500 rows (depends how fast you fill it).

1 Like

If you do move to InfluxDB you can set a retention policy which will do all the work for you.

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