Search code examples
c#azureazure-storageazure-table-storageazure-tablequery

Querying azure table without partitionkey and rowkey


I have Azure table called users which serveral fields related to user, I have PartitionKey as UserId and RowKey as CompanyId and I want to query the table via the Email field which is not an PartionKey or RowKey, Is it possible to query the table like this?

If yes then it is good to query without the PartitionKey and RowKey


Solution

  • You can query without using PartitionKey or RowKey and table service will not throw any errors however please keep in mind that this will do a full table scan starting from 1st PartitionKey/RowKey combination till the time matching entities are found.

    This may not be an issue if your table is small. However it will be an issue if your table becomes big. There would be a chance that you don't get any data back but just the continuation token and you would need to query your table again using that continuation token.

    If you want to query on Email field, I would highly recommend duplicating your data so that the Email field becomes the PartitionKey.

    Not sure if you have read this already, but I would highly recommend reading Azure Table Storage Design Guide: https://azure.microsoft.com/en-in/documentation/articles/storage-table-design-guide/.