mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
We have customers with tens or hundreds of thousands of applications, and we have a scheduler running that sets application fields to `announced` as true. However, every time it runs, it queries the entire table, which is slow and causes database connection acquisition issues. To make it faster, we added a partial index to the table.
18 lines
396 B
JavaScript
18 lines
396 B
JavaScript
'use strict';
|
|
|
|
exports.up = function(db, cb) {
|
|
db.runSql(
|
|
`
|
|
CREATE INDEX IF NOT EXISTS idx_client_applications_announced_false ON client_applications (announced)
|
|
WHERE announced = FALSE;
|
|
`,
|
|
cb,
|
|
);
|
|
};
|
|
|
|
exports.down = function(db, cb) {
|
|
db.runSql(`
|
|
DROP INDEX IF EXISTS idx_client_applications_announced_false;
|
|
`, cb);
|
|
};
|