I'm using DocumentDB. Given index policy:
messageType: string - precision -1
deviceId: string - precision -1
Query 1:
SELECT * FROM c WHERE c._ts >= 1563721200 AND c._ts < 1563807600 AND c.messageType = 'attack' AND c.deviceId >= 'A' AND c.deviceId < 'Z'
Query 2:
SELECT * FROM c WHERE c._ts >= 1563721200 AND c._ts < 1563807600 AND c.messageType = 'attack' AND c.deviceId >= 'A' AND c.deviceId < 'Z' ORDER BY c._ts DESC
Executing code:
var query = dbClientSource.CreateDocumentQuery<Document(UriFactory.CreateDocumentCollectionUri(db, collection),
sql,
new FeedOptions { MaxItemCount = 100, EnableCrossPartitionQuery = true })
.AsDocumentQuery();
while (query.HasMoreResults)
var result = await query.ExecuteNextAsync<Telemetry>();
Query 1 worked, however query 2 throw exception:
{
"code": "ServiceUnavailable",
"message": "The request failed because the client was unable to establish connections to 1 endpoints across 1 regions. The client CPU was overloaded during the attempted request.
}
The different thing is "ORDER BY" command. Is there any solutions?