A. Vindya
A. Vindya

Reputation: 117

Is there a way to query Azure Storage table using a column name which is not the partition key?

I've tried to query an azure table using a column name, but no data was returned after the execution. Following is the code I used in java. Does a table scan is needed?

String partitionFilter = TableQuery.generateFilterCondition(
            COLUMN_ID,
            TableQuery.QueryComparisons.EQUAL,
            columnId);

Upvotes: 5

Views: 2028

Answers (1)

Fei Han
Fei Han

Reputation: 27793

Does a table scan is needed?

Yes, it performs a table scan, because your filter does not include the PartitionKey. Please refer to "Design for querying" section to get detailed information.

no data was returned after the execution

Please check whether some data in your table storage can meet the Filter condition. Besides, you can use HTTP(S) traffic capture tool (such as fiddler) to capture the request and check whether any error or useful information included in the response, which will help you troubleshoot the issue.

Update:

Is there a way to index the column name, so that the query is more efficient?

Currently, there are no indexes other than that on the clustered index on the PartitionKey and RowKey in Azure table storage. If possible, you can modify your table design to improve performance. Besides, you can also move to Azure Cosmos DB's "premium table" that offers throughput-optimized tables, global distribution, and automatic secondary indexes.

Upvotes: 3

Related Questions