0
0
Fork 0

Add cold-start follow recommendations (#15945)

This commit is contained in:
Eugen Rochko 2021-04-12 12:37:14 +02:00 committed by GitHub
parent ad61265268
commit f7117646af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 560 additions and 26 deletions

View file

@ -0,0 +1,22 @@
SELECT
accounts.id AS account_id,
mode() WITHIN GROUP (ORDER BY language ASC) AS language,
mode() WITHIN GROUP (ORDER BY sensitive ASC) AS sensitive
FROM accounts
CROSS JOIN LATERAL (
SELECT
statuses.account_id,
statuses.language,
statuses.sensitive
FROM statuses
WHERE statuses.account_id = accounts.id
AND statuses.deleted_at IS NULL
ORDER BY statuses.id DESC
LIMIT 20
) t0
WHERE accounts.suspended_at IS NULL
AND accounts.silenced_at IS NULL
AND accounts.moved_to_account_id IS NULL
AND accounts.discoverable = 't'
AND accounts.locked = 'f'
GROUP BY accounts.id