1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-31 01:16:01 +02:00

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.
This commit is contained in:
Jaanus Sellin 2024-02-08 10:57:10 +02:00 committed by GitHub
parent c43d7c0653
commit bc7d4b8edb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,17 @@
'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);
};