To keep database performant and limit disk usage, it is recommended to clear old position and event data from the database. The following instuction is for Microsoft SQL Server.
WHILE (1 = 1)
BEGIN
DELETE TOP (10000)
FROM dbo.tc_events
WHERE eventTime < DATEADD(DAY, -120, GETDATE())
IF @@ROWCOUNT = 0
BREAK
WAITFOR DELAY '00:00:10' -- 10 second delay
ENDWHILE (1 = 1)
BEGIN
DELETE TOP (10000)
FROM dbo.tc_positions
WHERE fixTime < DATEADD(DAY, -120, GETDATE())
AND id NOT IN (SELECT positionId FROM dbo.tc_devices WHERE positionid IS NOT NULL)
IF @@ROWCOUNT = 0
BREAK
WAITFOR DELAY '00:00:10' -- 10 second delay
ENDFor MySQL instructions check this documentation.