2

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#.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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