- 32 months ago
This weekend our backend system that tracks pricing started failing. After investigating, I found the issue - one that I wasn't anticipating and hadn't set up proper tracking for.
We log price changes for eligible retailers (some don't let us store price history). Those get stored in a database with timestamp, change information (before/after price), which product it was for, etc. You know, pretty standard fare for price tracking. Each entry has it's own id - a plain signed integer. Not that we felt we needed it to be a signed value (which is pointless for id fields), but that is just the default data type and we ran with it. On our particular platform, that equates to a 32-bit signed in, which in turn gives you 31 bits of usable id. That you get 2,147,483,647 price changes (231 - 1, since the id starts at 1, not 0) - before you hit the max int value.
That's right - we've logged over 2 billion price changes so far.
Anyhow, we've patched things up, so now we're good for 263 - 1 price changes - that's 9,223,372,036,854,775,807 if you want the decimal form. I think we're good for the next few years now.