-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ancillary indexes to improve deletion. (#4508)
Provider deletion, or entity deletion in general, runs into performance problems without this indexes as two triggers for constraint were executing full table scans on pretty crowded tables. These two indexes solve that problem.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
database/migrations/000106_ancillary_evaluation_indexes.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- Copyright 2024 Stacklok, Inc | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
|
||
BEGIN; | ||
|
||
-- The following two indexes on alert_events and remediation_events | ||
-- are necessary to optimize deletions. | ||
DROP INDEX alert_events_evaluation_id_fk_idx; | ||
DROP INDEX remediation_events_evaluation_id_fk_idx; | ||
|
||
COMMIT; |
22 changes: 22 additions & 0 deletions
22
database/migrations/000106_ancillary_evaluation_indexes.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- Copyright 2024 Stacklok, Inc | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
|
||
BEGIN; | ||
|
||
-- The following two indexes on alert_events and remediation_events | ||
-- are necessary to optimize deletions. | ||
CREATE INDEX alert_events_evaluation_id_fk_idx ON alert_events (evaluation_id); | ||
CREATE INDEX remediation_events_evaluation_id_fk_idx ON remediation_events (evaluation_id); | ||
|
||
COMMIT; |