Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
bd492628
Commit
bd492628
authored
Mar 26, 2018
by
lain
Browse files
Speed up follower query.
parent
1d1271ca
Pipeline
#981
passed with stage
in 3 minutes and 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
bd492628
...
...
@@ -265,7 +265,7 @@ def get_or_fetch_by_nickname(nickname) do
def
get_followers
(%
User
{
id:
id
,
follower_address:
follower_address
})
do
q
=
from
u
in
User
,
where:
^
follower_address
in
u
.
following
,
where:
fragment
(
"? <@ ?"
,
^
[
follower_address
],
u
.
following
)
,
where:
u
.
id
!=
^
id
{
:ok
,
Repo
.
all
(
q
)}
...
...
priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs
View file @
bd492628
...
...
@@ -4,5 +4,6 @@ defmodule Pleroma.Repo.Migrations.AddFollowerAddressIndexToUsers do
@disable_ddl_transaction
true
def
change
do
create
index
(
:users
,
[
:follower_address
],
concurrently:
true
)
create
index
(
:users
,
[
:following
],
concurrently:
true
,
using:
:gin
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment