diff --git a/changelog.d/activity_type_index.change b/changelog.d/activity_type_index.change new file mode 100644 index 000000000..ea2d7adbe --- /dev/null +++ b/changelog.d/activity_type_index.change @@ -0,0 +1 @@ +Add new activity actor/type index. Greatly speeds up retrieval of rare types (like "Listen") diff --git a/priv/repo/migrations/20250314153704_add_activities_actor_type_index.exs b/priv/repo/migrations/20250314153704_add_activities_actor_type_index.exs new file mode 100644 index 000000000..3713beea1 --- /dev/null +++ b/priv/repo/migrations/20250314153704_add_activities_actor_type_index.exs @@ -0,0 +1,7 @@ +defmodule Pleroma.Repo.Migrations.AddActivitiesActorTypeIndex do + use Ecto.Migration + + def change do + create(index(:activities, ["actor", "(data ->> 'type'::text)", "id DESC NULLS LAST"])) + end +end