• Log In
  • Register

Too much price history

Forum Search


  • Be respectful to others
  • No spam
  • No NSFW content
  • No piracy or key resellers
  • No link shorteners
  • Offensive content will be removed


philip 22 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.

Comments Sorted by:

gorkti200 3 Builds 12 points 21 months ago

Too much price history, not enough benchmarking

Allan_M_Systems 6 points 21 months ago

2,147,483,647 price changes



FlyinToasteronie 3 points 22 months ago

Congratulations on hitting two billion price changes! (I can't even count that high!)

And nice job making the patch!

MannyPCs 2 points 21 months ago

That's insane.

WirelessCables 1 Build 2 points 21 months ago

Never again will someone say, " Awww, you only use scientific notation in school science class".

Congratulations on 231 - 1

Mtthwmths 2 Builds 1 point 21 months ago

I remember that number from Comp 1! Congrats on having an operation big enough for it to be a relevant problem!

[comment deleted]
[comment deleted]
[comment deleted by staff]