commit: eefa981e0ac1b426c23c339323813e9aaa462ca3
parent de37583c49bb43b67c009c36d42967dd9d117acb
Author: Haelwenn <contact+git.pleroma.social@hacktivis.me>
Date: Sun, 3 Jul 2022 22:01:37 +0000
Merge branch 'indexing-hotspots' into 'develop'
Add index hotspots
See merge request pleroma/pleroma!3664
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/priv/repo/migrations/20220506175506_add_index_hotspots.exs b/priv/repo/migrations/20220506175506_add_index_hotspots.exs
@@ -0,0 +1,17 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.AddIndexHotspots do
+ use Ecto.Migration
+
+ def change do
+ # Stop inserts into activities from doing a full-table scan of users:
+ create_if_not_exists(index(:users, [:ap_id, "COALESCE(follower_address, '')"]))
+
+ # Change two indexes and a filter recheck into one index scan:
+ create_if_not_exists(index(:following_relationships, [:follower_id, :state]))
+
+ create_if_not_exists(index(:notifications, [:user_id, :seen]))
+ end
+end