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

DevSprikkz 2 months 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 2 months ago
Slawek 2 months ago
delete from tc_positions where servertime < DATE(NOW() - INTERVAL 180 day);
Anton Tananaev 2 months ago

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