On Tuesday, September 20, 2011 5:42:32 PM UTC-4, nick name wrote:
>
> I need to have a number that generally increases with every request made to 
> the service. The only requirement is that it is strictly monotonous - I 
> don't need a specific start, and I don't care if there are any holes.
>
> Possible solutions: 
>
> - Insert a record into a dummy table, and use the last-row-id of the dummy 
> record. Occasionally, (e.g. in a batch job) delete every record except the 
> last. (Or maybe including the last? do all dbs supported maintain a sequence 
> counter independent of the current maximum value of a column?)
>

How are you going to use that number to determine which records have changed 
since last sync -- are you going to store it with each record in the table? 
If that's the plan, rather than creating a dummy table and keep adding 
records to it, can't the dummy table just include a single row (with a 
single field, besides id) containing the current count -- then just update 
that single record on every request (or more appropriately, every time 
there's an insert/update to the DB you're syncing)?

Anthony 

Reply via email to