Firefox Monitor: add index to subscribers.sha1 column in stage, then prod

VERIFIED FIXED

Status

VERIFIED FIXED
6 months ago
5 months ago

People

(Reporter: groovecoder, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 months ago
We are receiving a spike of HIBP callback requests which look up our subscribers by sha1 hash. The RDS node is maxing on CPU. :(

Adding an index to the sha1 column should help this.

create index on subscribers (sha1);
Index created in stage, please verify.
(In reply to Bob Micheletto [:bobm] from comment #1)
> Index created in stage, please verify.

Verification done by :groovecoder via IRC:
groovecoder> bobm: stage DB good - works for subscribing, verifying, and notifying

Production index has been added.
(Reporter)

Comment 3

5 months ago
Note: I've created a PR[1] to retro-actively add a migration for this DB change to our code-base for future environments. But since the index already exists in stage & prod, we should run this SQL to "fake" the migration that records this DB change:

INSERT INTO knex_migrations (name, batch, migration_time) values ('20181007085241_add_sha1_index.js', 4, '2018-10-07 08:52:42.000-05');

[1] https://github.com/mozilla/blurts-server/pull/520
Closing this bug.
Status: NEW → RESOLVED
Last Resolved: 5 months ago
Resolution: --- → FIXED
(Reporter)

Updated

5 months ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.