Use index on refresh_counter_cache
authorRoman Chvanikov <chvanikoff@pm.me>
Sat, 9 May 2020 10:13:26 +0000 (13:13 +0300)
committerRoman Chvanikov <chvanikoff@pm.me>
Sat, 9 May 2020 10:13:26 +0000 (13:13 +0300)
lib/mix/tasks/pleroma/refresh_counter_cache.ex

index b44e2545d08b6fc4f7b799eed585e0e31ac2dd4f..efcbaa3b1e9fc9962ae2a2a770059db4358ee4bd 100644 (file)
@@ -42,7 +42,7 @@ defmodule Mix.Tasks.Pleroma.RefreshCounterCache 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(