Note that there are some explanatory texts on larger screens.

plurals
  1. POAzure Storage Table design with multiple query points
    primarykey
    data
    text
    <p>I have the following Azure Storage Table.</p> <p><strong>PositionData table:</strong> </p> <pre><code>PartitionKey: ClientID + VehicleID RowKey: GUID Properties: ClientID, VehicleID, DriverID, Date, GPSPosition </code></pre> <p>Each vehicle will log up to 1,000,000 entities per year per client. Each client could have thousands of vehicles. So, I decided to partition by <code>ClientID</code> + <code>VehicleID</code> so to have small, manageable partitions. When querying by <code>ClientID</code> and <code>VehicleID</code>, the operation performs quickly because we are narrowing the search down to one partition.</p> <p><strong>PROBLEM:</strong> </p> <p>The problem here is that sometimes I need to query on only <code>ClientID</code> and <code>DriverID</code>. Because it's not possible to perform partial PartitionKey comparisons, every single partition will need to be scanned. This will kill performance.</p> <p>I can't have a PartitionKey with all <code>ClientID</code>, <code>VehicleID</code> and <code>DriverID</code> because queries will only ever query on <code>VehicleID</code> OR <code>DriverID</code>, never both.</p> <p><strong>SOLUTION 1:</strong></p> <p>I considered having a value stored elsewhere which represented a VehicleID and DriverID pair, and then having a <code>ClientID + VehicleDriverPairID</code> PartitionKey, but that would result in hundreds of thousands of partitions and there will be much unioning of data between partitions in my code.</p> <p><strong>SOLUTION 2:</strong></p> <p>Have a partition for <code>Client + VehicleID</code> and another partition for <code>Client + DriverID</code>. This means that updating the table is twice as much work (two updates) but both queries will be fast. Also there will be redundant data.</p> <p>Do any of these solutions sound viable? Other solutions? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload