Description
openedon Jan 5, 2023
- Package Name: @azure/cosmos
- Package Version: 3.17.2
- Operating system: MacOS
- nodejs
- version: 18.12.0
- browser
- name/version:
- typescript
- version:
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Create a SQL request involving multiple statements, like this one (metrics added to check query performance):
const { resources, queryMetrics } = await this.rolls.items
.query(`SELECT TOP 10 * from r WHERE r.sides = 6 ORDER BY r.timestamp DESC`, { populateQueryMetrics: true})
.fetchAll();
On my local environment, a request like this takes ~750ms on the first call, then ~400ms on subsequent calls (using a Cosmos DB with serverless tier and Core SQL API).
For comparison, a simple GET item by id or create item take ~110ms (about 100ms is because of HTTP latency, most of the rest is framework overhead).
Query metrics indicates that the query takes ~0.05ms to execute, and I get the same number in Data Explorer.
Expected behavior
Same performance as when doing a create/get by id request given the request metrics. Excluding the ~100ms latency, there's a 300ms overhead when trying to perform a SQL query with the JS SDK, which is definitely not ok.
Am I missing something here?