mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-15 04:28:25 +00:00
Optimize query for creating subscription feeds
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user