Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I store large quantities of GPS data in storage tables. Each partition can reach up to 1 million entities. Each GPS entity that is inserted into the table is actually sequential to the previous data inserted, so order matters.

Sometimes I need to perform the following query:

Get the previous/next 3 GPS entities from the current entity (within the same partition).

Options for RowKey design:

  1. Create an incrementing integer. But how do I track what the current size of the table is? There is no way to get table row count, or to get the last inserted row.

  2. Use DateTime Ticks. But how do get the previous/next entity using ticks?

I'm using the SDK version 2.0 in C#.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I think you will need to have a RowKey such Ticks + Guid - and I think you will have to specify a time-measurement precision that is meaningful for your GPS application. You want three data that are sequential in real time not just the recorded time. If you just use Ticks, then you'll end up with duplicates as described in this post: Why am I getting duplicate RowKey with DateTime.UtcNow.Ticks? Your time measurement system has a finite precision.

You will still need to query the partition for all entities in the partition. But you should then be able to identify data that is truly in time sequence to the practical precision of your system.

share|improve this answer
    
Thanks for your answer. That's a good point regarding the duplicate Tick values. I have gone with the following answer on StackOverflow. –  davenewza Mar 7 '13 at 9:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.