1
votes

I'm new to Cosmos DB. It's not clear from the documentation if there's any difference between the TOP x keyword and the OFFSET 0 LIMIT x clause in a plain (not having a GROUP BY clause) query?

From what I see results for these 2 queries are identical.

SELECT * FROM ROOT AS m ORDER BY m.id OFFSET 0 LIMIT 1
SELECT TOP 1 * FROM ROOT AS m ORDER BY m.id
2

2 Answers

0
votes

You are right, it doesn't make any difference in terms of performance & cost. You can try out the two queries and measure the Request Charge. They are identical for various different combinations I tried, which is a good indication that they are treated identically:

enter image description here

0
votes

I can't get clear description on it from ms document too. So I did a test.

enter image description here enter image description here