From the course: Microsoft Azure Cosmos DB Developer Specialty (DP-420) Cert Prep by Microsoft Press

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Choose when to use a point operation versus a query operation

Choose when to use a point operation versus a query operation

First of all, we remember that the least expensive way to query Cosmos DB in terms of request unit cost are point reads. Now, while these cost less, you need to know that in order to do a point read, you have to specify the item id and the partition key in your query. So you'll need to take that into account directly. Moreover, I've mentioned several times in the past how important choosing the right partition key is and keeping your query scoped where possible to a single logical partition. Single partition queries always cost at least 2.3 RUs even if you know the id in the key. Remember though, that these queries that go into Cosmos DB are deterministic and each time you run the same exact query, you'll be charged the same RU cost. It's deterministic. And then here is a sample SELECT statement where we're just bringing some raw filtering with complex WHERE clause, WHERE and AND, pretty straightforward. But because we're not…

Contents