Search code examples
azureazure-table-storageazure-tablequery

Unique list of PartionKey's in Azure Table Storage Account


I would like to get a unique list of PrimaryKey's used in an existing Azure Table Storage Account with a large amount of data. In this db there will be more than 20 unique Primary Key's and I would like to get this unique list back. Is there any FilterCondition or API that supports this?


Solution

  • Unfortunately no. There's no API available in Azure Table Storage that will give you the list of partition keys back.

    You will need to fetch all entities and extract the unique partition keys from the result set.

    To optimize this process, you can do a few things:

    • Run your application in a VM in the same region as that of the storage account. That way you're avoiding the latency + data egress charges.
    • Use Query Projection to only return PartitionKey in the result as you're only interested in getting that information.