From 56819f7f0604e5d4eb69edba1d6828256acbc7fe Mon Sep 17 00:00:00 2001 From: Roman Chvanikov Date: Sat, 9 May 2020 13:13:26 +0300 Subject: [PATCH] Use index on refresh_counter_cache --- lib/mix/tasks/pleroma/refresh_counter_cache.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/tasks/pleroma/refresh_counter_cache.ex b/lib/mix/tasks/pleroma/refresh_counter_cache.ex index b44e2545d..efcbaa3b1 100644 --- a/lib/mix/tasks/pleroma/refresh_counter_cache.ex +++ b/lib/mix/tasks/pleroma/refresh_counter_cache.ex @@ -42,7 +42,7 @@ defp instance_counters(instance) do Activity |> where([a], fragment("(? ->> 'type'::text) = 'Create'", a.data)) - |> where([a], like(a.actor, ^"%#{instance}%")) + |> where([a], fragment("split_part(?, '/', 3) = ?", a.actor, ^instance)) |> select( [a], {fragment(