1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00
unleash.unleash/src/migrations/20240207164033-client-applications-announced-index.js
Jaanus Sellin bc7d4b8edb
feat: add partial index on client_applications annouced FALSE (#6166)
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.
2024-02-08 10:57:10 +02:00

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);
};