1

I'm constructing and executing the following query:

var queryDate = new Date(2013, 6, 22);
var query = azure.TableQuery
                 .select()
                 .from("WADLogsTable")
                 .where("Timestamp > ?", queryDate);

 tableService.queryEntities(query, function(err, entities){
     ......
 });

However entities is returning as empty, if I remove the where clause then the entities collection is populated?

Any thoughts on what is wrong with this query?

If I dump out the query object to the console it looks like - { _fields: [], _from: 'WADLogsTable', _where: [ 'Timestamp gt datetime\'2013-07-21T23:00:00.000Z\'' ], _top: null, _partitionKey: null, _nextPartitionKey: null, _rowKey: null, _nextRowKey: null }

4

1 回答 1

0

由于您的查询不包括PartitionKey,因此您的查询导致全表扫描。对于表服务的每个查询请求,它最多可以返回 1000 个匹配实体。如果未找到匹配项并且有更多实体可用,则表服务将返回一个继续令牌,该令牌应用于获取下一组实体。因此,在您的情况下发生的是表服务从顶部(第一个分区)开始并尝试查找与您的查询条件匹配的实体。由于它没有找到任何东西,因此它不返回任何值。但是,如果您检查响应标头,您应该会看到类似x-ms-continuation-NextPartitionKey和的标头x-ms-continuation-NextRowKey

为获得最佳性能,您的查询应始终包含 PartitionKey。看看这篇关于有效获取我前段时间写的诊断数据的博客文章:http: //gauravmantri.com/2012/02/17/effective-way-of-fetching-diagnostics-data-from-windows-azure-诊断表提示使用分区键/

于 2013-07-22T11:49:37.137 回答