postgres optimisations and daily sqlite vacuum
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-15 19:43:20 +11:00
parent 75a5f31a2f
commit f0bacab729
6 changed files with 56 additions and 43 deletions

View File

@@ -99,6 +99,8 @@ CREATE TABLE IF NOT EXISTS snapshot_registry (
if err != nil && !strings.Contains(strings.ToLower(err.Error()), "duplicate column name") {
return err
}
_, _ = dbConn.ExecContext(ctx, `CREATE INDEX IF NOT EXISTS idx_snapshot_registry_type_time ON snapshot_registry (snapshot_type, snapshot_time)`)
_, _ = dbConn.ExecContext(ctx, `CREATE INDEX IF NOT EXISTS idx_snapshot_registry_table_name ON snapshot_registry (table_name)`)
return nil
case "pgx", "postgres":
_, err := dbConn.ExecContext(ctx, `
@@ -117,6 +119,8 @@ CREATE TABLE IF NOT EXISTS snapshot_registry (
if err != nil && !strings.Contains(strings.ToLower(err.Error()), "column \"snapshot_count\" of relation \"snapshot_registry\" already exists") {
return err
}
_, _ = dbConn.ExecContext(ctx, `CREATE INDEX IF NOT EXISTS idx_snapshot_registry_type_time ON snapshot_registry (snapshot_type, snapshot_time DESC)`)
_, _ = dbConn.ExecContext(ctx, `CREATE INDEX IF NOT EXISTS idx_snapshot_registry_table_name ON snapshot_registry (table_name)`)
return nil
default:
return fmt.Errorf("unsupported driver for snapshot registry: %s", driver)