Monday, 22 May 2017

dynamodb - how to efficiently get next free number

I am writing a node.js application using dynamodb as databse.

I have a Table where one attribute (not primary-key or sort-key) stores the used number of my application. Lets call it #a. #a contains number values which needs to be unique. On every new entry #a get mostly incremented by 1, if that incremented number does not exists. now I need a way to get the next possible (free) number that can be used up for a new entry. lets say I'm currently at the value 99 and the table already contains all the value from 100 - 10.000, I need to get back 10.001.

I tried to keep track of the used number-values in a different table row, by storing them in a list, but I rapidly exceeding the 400kb memory constraint and I also have an overhead to calc the next free entry.

You guys know how to solve this ?



via sami_analyst

No comments:

Post a Comment