Reputation: 9003
Very simple lookup, use A to lookup B, A is unique value in whole table, B is unique value in whole table as well
method 1:
PartionKey => A
RowKey => B
lookup by TOP(1) PartionKey eq "A"
method 2:
PartionKey => A
RowKey => "" (empty string)
Value => B
lookup by TOP(1) (PartionKey eq "A") and (RowKey eq "")
method 3:
PartionKey => "" (empty string)
RowKey => A
Value => B
lookup by TOP(1) (PartionKey eq "") and (RowKey eq "A")
Question: Which is faster?
Upvotes: 1
Views: 1132
Reputation: 1749
If I understand your question… If A is a unique value across the whole table, B’s uniqueness is irrelevant. So you are better off, scalability wise, to split A in two, and use the first part as the Partition Key and the second part as the Row Key.
It is important to understand that in Azure table storage, PartitionKey + RowKey is analogous to the Primary Key in an SQL database, and it’s most efficient to use the whole primary key for a lookup.
Upvotes: 1
Reputation: 60153
In method #2, the row key is empty, but you're query specifies a non-empty row key (of "B"). Did you mean and (RowKey eq "")
? If so, that method is faster, in that it will always return a result. Method #1 may return an empty result set with a continuation token, at which point you have to make a second query to actually get at the data.
Upvotes: 1