Optimize views sort sql query

pull/3818/head
Chocobozzz 2021-03-03 11:24:16 +01:00
parent 6c9c3b7b14
commit 534556052e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 27 additions and 2 deletions

View File

@ -24,7 +24,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
const LAST_MIGRATION_VERSION = 605
const LAST_MIGRATION_VERSION = 610
// ---------------------------------------------------------------------------

View File

@ -0,0 +1,20 @@
import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
db: any
}): Promise<void> {
await utils.sequelize.query('DROP INDEX IF EXISTS video_views;')
}
function down (options) {
throw new Error('Not implemented.')
}
export {
up,
down
}

View File

@ -426,7 +426,12 @@ export type AvailableForListIDsOptions = {
]
},
{ fields: [ 'duration' ] },
{ fields: [ 'views' ] },
{
fields: [
{ name: 'views', order: 'DESC' },
{ name: 'id', order: 'ASC' }
]
},
{ fields: [ 'channelId' ] },
{
fields: [ 'originallyPublishedAt' ],