Skip to content

Commit

Permalink
Add index on timestamp column in detected_spam table
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Jan 20, 2024
1 parent 296b51b commit e1c7166
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/storage/detected_spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func NewDetectedSpam(db *sqlx.DB) (*DetectedSpam, error) {
if err != nil {
return nil, fmt.Errorf("failed to create detected_spam table: %w", err)
}

// add index on timestamp
if _, err = db.Exec(`CREATE INDEX IF NOT EXISTS idx_detected_spam_timestamp ON detected_spam(timestamp)`); err != nil {
return nil, fmt.Errorf("failed to create index on timestamp: %w", err)
}

return &DetectedSpam{db: db}, nil
}

Expand Down

0 comments on commit e1c7166

Please sign in to comment.