mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Attempt to optimize query for subscription feed
This commit is contained in:
parent
775612ec5a
commit
c34a24b633
3 changed files with 8 additions and 17 deletions
|
@ -1282,10 +1282,7 @@ post "/login" do |env|
|
|||
PG_DB.exec("INSERT INTO session_ids VALUES ($1, $2, $3)", sid, email, Time.utc)
|
||||
|
||||
view_name = "subscriptions_#{sha256(user.email)}"
|
||||
PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS \
|
||||
SELECT * FROM channel_videos WHERE
|
||||
ucid IN (SELECT unnest(subscriptions) FROM users WHERE email = E'#{user.email.gsub("'", "\\'")}')
|
||||
ORDER BY published DESC")
|
||||
PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS #{MATERIALIZED_VIEW_SQL.call(user.email)}")
|
||||
|
||||
if Kemal.config.ssl || config.https_only
|
||||
secure = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue