mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
f9c3259083
## About the changes Add partial index on events by announced. This should help avoid `Seq Scan on events` when the majority of events are announced=true --- Co-authored-by: Ivar Østhus <ivar@getunleash.io> Co-authored-by: Gard Rimestad <gard@getunleash.io>
18 lines
473 B
JavaScript
18 lines
473 B
JavaScript
'use strict';
|
|
|
|
exports.up = function (db, callback) {
|
|
db.runSql(
|
|
`
|
|
UPDATE events set announced = false where announced IS NULL;
|
|
ALTER TABLE events ALTER COLUMN announced SET NOT NULL;
|
|
ALTER TABLE events ALTER COLUMN announced SET DEFAULT false;
|
|
CREATE INDEX events_unannounced_idx ON events(announced) WHERE announced = false;
|
|
`,
|
|
callback(),
|
|
);
|
|
};
|
|
|
|
exports.down = function (db, callback) {
|
|
callback();
|
|
};
|