Skip to content

Cleaning Up Old Records

B.Fatih KOZ edited this page Jan 12, 2022 · 4 revisions

After a period, you may wish to clean up old records. This may be related with database space, overall performance or just an airline/admin decision to keep records only a certain amount of time like in the real world.

Like deleting old SimBrief flight plan packages or old acars positions reports. Deciding the amount of time, either by months or by days is up to you. For example for a flight, real authorities may want digital backups to be kept safe for a year but printed out (paper) copies of the same document is deleted after 3 months, considering that the flight was uneventful and finished safely.

You may want to do the same, we do have only digital copies here of course, below you can find some example queries to achieve this. Please check the time amounts I used and change according to your needs.

Cleaning Old Acars Position Reports

DELETE
FROM acars
WHERE type = 0 AND created_at < DATE_SUB(NOW(), INTERVAL 180 DAY);

Cleaning Old SimBrief Flight Plan Packages (OFPs)

DELETE
FROM simbrief
WHERE created_at < DATE_SUB(NOW(), INTERVAL 90 DAY);

You can use MONTH instead of DAY, like INTERVAL 6 MONTH in above queries.