Index notifications to allow faster lookup by kind, entity id

This commit is contained in:
Max Brunsfeld 2023-10-19 13:00:07 -07:00
parent 841cfac1f8
commit 33f06d3104
2 changed files with 8 additions and 2 deletions

View file

@ -341,4 +341,7 @@ CREATE TABLE "notifications" (
"response" BOOLEAN "response" BOOLEAN
); );
CREATE INDEX "index_notifications_on_recipient_id_is_read" ON "notifications" ("recipient_id", "is_read"); CREATE INDEX
"index_notifications_on_recipient_id_is_read_kind_entity_id"
ON "notifications"
("recipient_id", "is_read", "kind", "entity_id");

View file

@ -16,4 +16,7 @@ CREATE TABLE notifications (
"response" BOOLEAN "response" BOOLEAN
); );
CREATE INDEX "index_notifications_on_recipient_id" ON "notifications" ("recipient_id"); CREATE INDEX
"index_notifications_on_recipient_id_is_read_kind_entity_id"
ON "notifications"
("recipient_id", "is_read", "kind", "entity_id");