mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +01:00
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.
20 lines
358 B
JavaScript
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,
|
|
);
|
|
};
|