有没有一种方法可以使用不是分区键的列名来查询 Azure 存储 table?

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

我尝试使用列名查询 azure table,但执行后没有返回任何数据。以下是我在 java 中使用的代码。是否需要 table 扫描?

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

Does a table scan is needed?

是的,它执行 table 扫描,因为您的过滤器不包含 PartitionKey。请参阅“Design for querying”部分以获取详细信息。

no data was returned after the execution

请检查您的table存储中的部分数据是否满足过滤条件。此外,您可以使用HTTP(S)流量抓包工具(如fiddler)抓取请求,查看响应中是否包含错误或有用信息,有助于排查问题。

更新:

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

目前,除了 Azure table 存储中的 PartitionKey 和 RowKey 上的聚簇索引外,没有其他索引。如果可能,您可以修改 table design to improve performance. Besides, you can also move to Azure Cosmos DB's "premium table" 以提供吞吐量优化 table、全球分布和自动二级索引。