mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
Add index hotspots
squash
This commit is contained in:
parent
f9943b2065
commit
aa51fd068b
1 changed files with 17 additions and 0 deletions
17
priv/repo/migrations/20220506175506_add_index_hotspots.exs
Normal file
17
priv/repo/migrations/20220506175506_add_index_hotspots.exs
Normal file
|
@ -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
|
Loading…
Reference in a new issue