mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
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.
This commit is contained in:
parent
99f878d725
commit
ea057d1777
19
src/migrations/20240812120954-add-archived-at-to-projects.js
Normal file
19
src/migrations/20240812120954-add-archived-at-to-projects.js
Normal file
@ -0,0 +1,19 @@
|
||||
'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,
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user