From 0ce7d4e12a538775c315bddddacb3488ce803a51 Mon Sep 17 00:00:00 2001 From: lseeger Date: Sun, 15 Dec 2024 16:28:15 +0100 Subject: [PATCH] added index on (person_id, read) on post actions where read is not null --- .../down.sql | 1 + .../up.sql | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/down.sql create mode 100644 migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/up.sql diff --git a/migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/down.sql b/migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/down.sql new file mode 100644 index 000000000..f7d99ed9b --- /dev/null +++ b/migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/down.sql @@ -0,0 +1 @@ +DROP idx_post_actions_on_read_read_not_null; diff --git a/migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/up.sql b/migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/up.sql new file mode 100644 index 000000000..388d9595b --- /dev/null +++ b/migrations/2024-12-15-151642_add_index_on_person_id_read_for_read_only_post_actions/up.sql @@ -0,0 +1,3 @@ +CREATE INDEX idx_post_actions_on_read_read_not_null ON post_actions (person_id, read) +WHERE + read IS NOT NULL;