Clean DB Mysql

Jérôme 3 years ago

Hello everyone, do you have a doc or method to clean the database?

My goal is for example to keep only the routes over 1 year and to delete the old routes.

What table is it?

What is the command to run?

Thanks in advance !

jay 3 years ago

login to mysql

delete from tc_positions where servertime < DATE(NOW() - INTERVAL 180 day);
Anton Tananaev 3 years ago

We have a documentation specifically for this:

https://www.traccar.org/clear-history/

Jérôme 3 years ago

Hello, thank you for your feedback.

I don't want automation, I'm really looking for a tutorial / explanation to do it manually please.

Thanks

Anton Tananaev 3 years ago

You don't have to automate it if you don't want. You can do it manually using the information provided on that page.

Jérôme 3 years ago

Ok so it's fine in:

tc_positions?

Possible to have the command to execute to keep 1 year?

Thanks

Juan Sánchez 3 years ago

You only have to modify the query provided…

login to mysql

delete from tc_positions where servertime < DATE(NOW() - INTERVAL 365 day);
Jérôme 3 years ago

Thx !!!

Mark 2 years ago

https://www.traccar.org/clear-history/
Which traccar versions does this documentation apply to?
I ran the script on 4.11. It removes the data from the tc_positions table but overloads the server and won't finish. I have to kill it.

Anton Tananaev 2 years ago

It applies to the latest version and maybe for some recent versions, but you have to double check yourself before using it.