mirror of https://github.com/Chocobozzz/PeerTube
Don't add a LIMIT 1 to prevent seq scan
parent
d3dd952cc5
commit
dd7de7e32d
|
@ -139,7 +139,8 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi
|
|||
})
|
||||
|
||||
static doesInfohashExist (infoHash: string) {
|
||||
const query = 'SELECT 1 FROM "videoStreamingPlaylist" WHERE "p2pMediaLoaderInfohashes" @> $infoHash LIMIT 1'
|
||||
// Don't add a LIMIT 1 here to prevent seq scan by PostgreSQL (not sure why id doesn't use the index when we add a LIMIT)
|
||||
const query = 'SELECT 1 FROM "videoStreamingPlaylist" WHERE "p2pMediaLoaderInfohashes" @> $infoHash'
|
||||
|
||||
return doesExist(this.sequelize, query, { infoHash: `{${infoHash}}` }) // Transform infoHash in a PG array
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue