When using tables that have ranged columns, you can choose to search using the 'Key First', or 'Range First' mode from the dropdown box in the Table Definition screen.
These modes simply determine which of the two different types of lookups is performed first, and can yield different results depending on your
requirements.
Table Contents:
Key |
RangeKey |
Data |
foo |
5 |
a |
bar |
10 |
b |
bar |
15 |
c |
foo |
20 |
d |
Ranged Table Look-ups:
Mode |
Key |
RangeKey |
Result |
KeyFirst |
foo |
[Up] 3 |
a |
RangeFirst |
foo |
[Up] 3 |
a |
KeyFirst |
bar |
[Up] 3 |
b |
RangeFirst |
bar |
[Up] 3 |
(None) |
1.[KeyFirst] We are filtering on (non-ranged) keys first, so using 'foo' as the key we end up with two possible RangeKeys of 5 and 20 - ranging up on this with a value of 3 gives us 5. Using 'foo' and 5 as keys, we get 'a' as the result.
2.[RangeFirst] We are filtering on ranged keys first, so ranging up with a value of 3 gives us 5. Using 5 for RangeKey and 'foo' for 'Key', we get 'a' as the result (this case shows no difference between KeyFirst/RangeFirst but is only a consequence of the data).
3.[KeyFirst] Using 'bar' as the key, we end up with a different subset of RangeKeys of 10 and 15. Ranging up on this with 3 gives us 10. Using 'bar' and 10 as keys, we get 'b' as the result.
4.[RangeFirst] Ranging up using 3 gives us 5. However, now using 'bar' and 5 as the keys gives us no result.