Skip to content

Commit 7b0bcc1

Browse files
perf(db): Extend jobs.time_sensitive index
Nextcloud commonly selects a job by looking at all three columns. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent fcef905 commit 7b0bcc1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

core/Application.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ public function __construct() {
190190
'job_lastcheck_reserved',
191191
['last_checked', 'reserved_at']
192192
);
193+
$event->replaceIndex(
194+
'jobs',
195+
['jobs_time_sensitive'],
196+
'jobs_sensitive_lastcheck_reserved',
197+
['time_sensitive', 'last_checked', 'reserved_at'],
198+
false,
199+
);
193200

194201
$event->addMissingIndex(
195202
'direct_edit',

core/Migrations/Version24000Date20220131153041.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3030
$table->addColumn('time_sensitive', Types::SMALLINT, [
3131
'default' => 1,
3232
]);
33-
$table->addIndex(['time_sensitive'], 'jobs_time_sensitive');
33+
// jobs_time_sensitive replaced by jobs_sensitive_lastcheck_reserved
34+
// $table->addIndex(['time_sensitive'], 'jobs_time_sensitive');
35+
// Added later on (32 and backported)
36+
$table->addIndex(['time_sensitive', 'last_checked', 'reserved_at'], 'jobs_sensitive_lastcheck_reserved');
3437
return $schema;
3538
}
3639
return null;

0 commit comments

Comments
 (0)