Added indexes to scene tag and movie scene tables improve performance. Removed scene count from channel overview, too expensive.

This commit is contained in:
DebaucheryLibrarian 2022-01-24 00:15:11 +01:00
parent fc318536aa
commit 7ceec1c739
4 changed files with 21 additions and 9 deletions

View File

@ -40,8 +40,11 @@
>{{ entity.name }}</span>
</div>
<span class="count">
<span>{{ entity.sceneTotal }} scenes</span>
<span
v-if="entity.childrenTotal > 0 || typeof entity.sceneTotal !== 'undefined'"
class="count"
>
<span v-if="typeof entity.sceneTotal !== 'undefined'">{{ entity.sceneTotal }} scenes</span>
<span v-if="entity.type === 'network'">{{ entity.childrenTotal }} channels</span>
</span>
</router-link>

View File

@ -194,12 +194,6 @@ function initEntitiesActions(store, router) {
url
independent
hasLogo
children: childEntitiesConnection {
totalCount
}
connection: scenesConnection {
totalCount
}
}
}
`, {

View File

@ -0,0 +1,15 @@
exports.up = async (knex) => Promise.resolve()
.then(() => knex.schema.alterTable('releases_tags', (table) => {
table.index('release_id');
}))
.then(() => knex.schema.alterTable('movies_scenes', (table) => {
table.index('scene_id');
}));
exports.down = async (knex) => Promise.resolve()
.then(() => knex.schema.alterTable('releases_tags', (table) => {
table.dropIndex('release_id');
}))
.then(() => knex.schema.alterTable('movies_scenes', (table) => {
table.dropIndex('scene_id');
}));

View File

@ -262,7 +262,7 @@ async function fetchLatest(entity, page, options) {
.select('name')
.where('priority', '>', 7)
.orderByRaw('random()')
.limit(faker.datatype.number({ min: 2, max: 15 }))
.limit(faker.datatype.number({ min: 15, max: 25 }))
.pluck('name');
release.actors = [...actors(release), null]; // include empty actor to ensure proper handling