mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Optimize query for creating subscription feeds
This commit is contained in:
parent
71bf8b6b4d
commit
108648b427
3 changed files with 17 additions and 12 deletions
|
@ -1224,9 +1224,9 @@ post "/login" do |env|
|
|||
|
||||
view_name = "subscriptions_#{sha256(user.email)}"
|
||||
PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS \
|
||||
SELECT * FROM channel_videos WHERE \
|
||||
ucid = ANY ((SELECT subscriptions FROM users WHERE email = E'#{user.email.gsub("'", "\\'")}')::text[]) \
|
||||
ORDER BY published DESC;")
|
||||
SELECT * FROM channel_videos WHERE
|
||||
ucid IN (SELECT unnest(subscriptions) FROM users WHERE email = E'#{user.email.gsub("'", "\\'")}')
|
||||
ORDER BY published DESC")
|
||||
|
||||
if Kemal.config.ssl || config.https_only
|
||||
secure = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue