aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-08 11:16:34 +0100
committerChocobozzz <me@florianbigard.com>2020-01-08 11:16:34 +0100
commit8ee988c3167229d294121af527d8fb5ed339eac9 (patch)
treec88ee222a2941b1c14f60d61f0031f689b672d49
parent8ba9c205ba239fed18741bed36ad2fb2032cd5b2 (diff)
downloadPeerTube-8ee988c3167229d294121af527d8fb5ed339eac9.tar.gz
PeerTube-8ee988c3167229d294121af527d8fb5ed339eac9.tar.zst
PeerTube-8ee988c3167229d294121af527d8fb5ed339eac9.zip
Optimize videos list SQL query
-rw-r--r--server/models/video/video.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index fec3dcc20..87ad80caf 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -452,7 +452,14 @@ export type AvailableForListIDsOptions = {
452 'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' + 452 'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' +
453 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' + 453 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' +
454 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + 454 'WHERE "actorFollow"."actorId" = ' + actorIdNumber +
455 ' UNION ALL ' + 455 ')'
456 )
457 }
458 },
459 {
460 id: {
461 [ Op.in ]: Sequelize.literal(
462 '(' +
456 'SELECT "video"."id" AS "id" FROM "video" ' + 463 'SELECT "video"."id" AS "id" FROM "video" ' +
457 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' + 464 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +
458 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' + 465 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' +