-
Notifications
You must be signed in to change notification settings - Fork 976
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add missing indexes and remove unused index (#3756)
- Loading branch information
Showing
5 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
4 changes: 4 additions & 0 deletions
4
persistence/sql/migrations/sql/20240214113828000000_courier_dispatch_indices.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,4 @@ | ||
CREATE INDEX IF NOT EXISTS courier_message_dispatches_id_message_id_nid_idx ON courier_message_dispatches (id ASC, message_id ASC, nid ASC); | ||
|
||
DROP INDEX courier_message_dispatches_message_id_idx; | ||
DROP INDEX courier_message_dispatches_nid_idx; |
6 changes: 6 additions & 0 deletions
6
persistence/sql/migrations/sql/20240214113828000000_courier_dispatch_indices.mysql.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,6 @@ | ||
CREATE INDEX courier_message_dispatches_id_message_id_nid_idx ON courier_message_dispatches (id ASC, message_id ASC, nid ASC); | ||
|
||
-- These can't be removed because of foreign key constraints which disallow index deletion in MySQL. | ||
|
||
-- DROP INDEX courier_message_dispatches_message_id_idx ON courier_message_dispatches; | ||
-- DROP INDEX courier_message_dispatches_nid_idx ON courier_message_dispatches; |
8 changes: 8 additions & 0 deletions
8
persistence/sql/migrations/sql/20240214113828000000_courier_dispatch_indices.mysql.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,8 @@ | ||
-- Remove unused index | ||
DROP INDEX courier_message_dispatches_id_message_id_nid_idx ON courier_message_dispatches; | ||
|
||
-- For pop eager load | ||
CREATE INDEX courier_message_dispatches_message_id_idx ON courier_message_dispatches (message_id, created_at DESC); | ||
|
||
-- For delete by nid | ||
CREATE INDEX courier_message_dispatches_nid_idx ON courier_message_dispatches (nid); |
8 changes: 8 additions & 0 deletions
8
persistence/sql/migrations/sql/20240214113828000000_courier_dispatch_indices.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,8 @@ | ||
-- Remove unused index | ||
DROP INDEX courier_message_dispatches_id_message_id_nid_idx; | ||
|
||
-- For pop eager load | ||
CREATE INDEX IF NOT EXISTS courier_message_dispatches_message_id_idx ON courier_message_dispatches (message_id, created_at DESC); | ||
|
||
-- For delete by nid | ||
CREATE INDEX IF NOT EXISTS courier_message_dispatches_nid_idx ON courier_message_dispatches (nid); |