Cosmos db sql - OFFSET + LIMIT vs continuatrion token - what is more efficient RRS feed

  • Question

  • Hi guys,

    I wonder what is more efficient to use in terms of time and RUs consumption.

    To use OFFSET +LIMIT syntax, or pass continuation token with the sdk combining with passing the TopResult parameter in the FeedOption.



    Sunday, December 8, 2019 3:22 PM


All replies

  • Hi Yaron,

    Is this for a single partition query? Per the Remarks:

    Currently this clause is supported for queries within a single partition only, cross-partition queries don't yet support it.

    Otherwise, it is likely more efficient than retrieving a large result-set and using the continuation token method to page through all the data.

    Please let me know if you have any additional questions.



    Monday, December 9, 2019 11:42 PM
  • Yes my scenario is for single partition.

    But in terms of single round trip is there any difference when i ask for example to limit 100 results to return the client?

    Tuesday, December 10, 2019 11:43 AM
  • Hi Yaron,

    They should be about the same but to know exactly, there is a means to retrieve the request charge amount, where by using this mechanism you can get an idea of efficiency. This can be done via the Azure Portal or programmatically via a client SDK for the SQL (Core) API. The other APIs have a limited means of retrieving the request charge.

    Find the request unit charge in Azure Cosmos DB

    It depends upon the API you are using, so please select the API you are working with:

    SQL (Core) API

    Azure Cosmos DB API for Mongo DB

    Cassandra API

    Gremlin API

    Table API



    Tuesday, December 10, 2019 5:43 PM