Add index hotspots
ci/woodpecker/push/release Pipeline was successful Details
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/release Pipeline was successful Details
ci/woodpecker/pr/test Pipeline failed Details
ci/woodpecker/push/test Pipeline failed Details

This commit is contained in:
Pete 2022-07-01 13:59:26 +01:00 committed by FloatingGhost
parent ee4646949e
commit 56203aae30
1 changed files with 17 additions and 0 deletions

View 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