1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-19 00:15:43 +01:00
unleash.unleash/src/migrations/20240812120954-add-archived-at-to-projects.js
Jaanus Sellin ea057d1777
feat: add index on events created at (#7836)
After adding an index, the time for the new event search on 100k events
decreased from 5000ms to 4ms. This improvement is due to the query using
an index scan instead of a sequence scan.
2024-08-12 12:46:50 +03:00

20 lines
358 B
JavaScript

'use strict';
exports.up = function (db, callback) {
db.runSql(
`
CREATE INDEX idx_events_created_at_desc ON events (created_at DESC);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
`
DROP INDEX IF EXISTS idx_events_created_at_desc;
`,
callback,
);
};