diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-08 11:16:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-08 11:16:34 +0100 |
commit | 8ee988c3167229d294121af527d8fb5ed339eac9 (patch) | |
tree | c88ee222a2941b1c14f60d61f0031f689b672d49 /server/models/video/video.ts | |
parent | 8ba9c205ba239fed18741bed36ad2fb2032cd5b2 (diff) | |
download | PeerTube-8ee988c3167229d294121af527d8fb5ed339eac9.tar.gz PeerTube-8ee988c3167229d294121af527d8fb5ed339eac9.tar.zst PeerTube-8ee988c3167229d294121af527d8fb5ed339eac9.zip |
Optimize videos list SQL query
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 9 |
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" ' + |