Skip to content

Commit

Permalink
Add a composite index to improve the SELECT query speed
Browse files Browse the repository at this point in the history
  • Loading branch information
taolx0 committed Dec 21, 2023
1 parent 8dd9957 commit 1dac6ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sqle/model/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func (s *Storage) AutoMigrate() error {
if err != nil {
return errors.New(errors.ConnectStorageError, err)
}
err = s.db.Model(&SqlManage{}).AddIndex("idx_project_id_status_deleted_at", "project_id", "status", "deleted_at").Error
if err != nil {
return errors.New(errors.ConnectStorageError, err)
}

err = s.db.Model(BlackListAuditPlanSQL{}).AddUniqueIndex("uniq_type_content", "filter_type", "filter_content").Error
if err != nil {
Expand Down

0 comments on commit 1dac6ae

Please sign in to comment.