Safely delete tc_positions data older than 6 months to free up space

DevSprikkz a day ago

Hi,

My Traccar database has grown significantly (over 10GB), mainly due to the tc_positions table. I need to free up disk space by deleting old history manually.

What is the safest and most efficient SQL query to delete all positions older than 6 months (180 days) while keeping the recent data intact?

Thanks.

Anton Tananaev 19 hours ago
Slawek 14 hours ago
delete from tc_positions where servertime < DATE(NOW() - INTERVAL 180 day);
Anton Tananaev 14 hours ago

Doing it as a single query is a really bad idea. It will block table for a long time.