Recreate sql-stats-compaction Schedule

Hi,

On clean install of v21, I can see there is default schedule related to hourly sql-stats-compaction owned by node. After full restoring from v20 backup, I lost that schedule. What is the purpose of sql-stats-compaction? How can I recreate that schedule if it is important?

Best regards.

What is the purpose of sql-stats-compaction?

In 21.2, CockroachDB starts to persist Statement and Transaction statistics (aka SQL Stats). The purpose of the sql-stats-compaction job is to compact and delete older SQL Stats that are far into the past to relieve storage overhead.

How can I recreate that schedule if it is important?

You don’t have to. In 21.2, CockroachDB automatically checks for the existence of the sql-stats-compaction job at a low frequency (~ every 6 hours or so), and if it noticed that the schedule is missing, it will recreate it on its own.

Hope it helps!
Archer

1 Like