<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marcelo Fonseca on Medium]]></title>
        <description><![CDATA[Stories by Marcelo Fonseca on Medium]]></description>
        <link>https://medium.com/@fonseca_mar?source=rss-6995166018aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Marcelo Fonseca on Medium</title>
            <link>https://medium.com/@fonseca_mar?source=rss-6995166018aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:50:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fonseca_mar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Query Performance Tuning in Azure DocumentDB — A Practical Guide]]></title>
            <link>https://medium.com/@fonseca_mar/query-performance-tuning-in-azure-documentdb-a-practical-guide-f3035842e4dd?source=rss-6995166018aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3035842e4dd</guid>
            <category><![CDATA[database-optimization]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[azure-documentdb]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Marcelo Fonseca]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 23:10:46 GMT</pubDate>
            <atom:updated>2026-07-08T23:11:20.959Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A step-by-step walkthrough using explain(), index strategies, and the ESR rule</strong></p><p>Writing a query that <em>works</em> is easy. Writing a query that <em>scales</em> is a different story.</p><p>As collections grow to millions of documents, queries that returned results in milliseconds during development start taking seconds or timing out entirely. The root cause is almost always the same: the database is doing far more work than it needs to.</p><p>In this post, we’ll take a single, realistic query and walk through the full optimization process: running <em>explain()</em> to understand what’s happening under the hood, building indexes step by step, and applying the <strong>ESR rule</strong> to design a compound index that eliminates wasted scans and in-memory sorts. By the end, you’ll have a repeatable mental model for diagnosing and fixing slow queries in Azure DocumentDB.</p><p><strong>— -</strong></p><p><strong>Before You Optimize: Find the Slow Queries</strong></p><p>Before diving into <em>explain()</em>, you need to know <em>which</em> queries to investigate. In Azure DocumentDB, slow query detection is done through <strong>Diagnostic Logs</strong> integrated with <strong>Azure Log Analytics</strong>.</p><p>To get started, enable diagnostic logs for your cluster and route them to a Log Analytics workspace. Full setup instructions are available in the <a href="https://learn.microsoft.com/en-us/azure/documentdb/how-to-monitor-diagnostics-logs">official documentation</a>.</p><p>Once logs are flowing, use the following KQL query in Log Analytics to surface the slowest queries:</p><pre>VCoreMongoRequests<br>| where DurationMs &gt; 1000<br>| project TimeGenerated, DatabaseName, CollectionName,<br>          OperationName, DurationMs, PiiCommandText<br>| order by DurationMs desc<br>| take 20</pre><p>Key fields to look at in the results:</p><p>- <strong>DurationMs: </strong>Query execution time in milliseconds</p><p>- <strong>OperationName: </strong>Type of operation (find, aggregate, update, etc.)</p><p>- <strong>CollectionName: </strong>Which collection the query ran against</p><p>- <strong>PiiCommandText: </strong>The actual command that was executed</p><p>Once you have a candidate query, copy it and run <em>explain()</em> on it directly against the database.</p><p><strong>— -</strong></p><p><strong>The Problem Query</strong></p><p>Let’s start with something you’ve probably written before:</p><pre>db.orders.find({<br>  status: &quot;shipped&quot;,<br>  customerId: &quot;C-4821&quot;,<br>  createdAt: { $gte: ISODate(&quot;2024-01-01&quot;) }<br>}).sort({ createdAt: -1 })</pre><p>Looks innocent. But under load, this query can become your worst enemy. Let’s diagnose it.</p><p><strong>— -</strong></p><p><strong>Step 1 — Run explain() and Read It</strong></p><pre>db.orders.find({<br>  status: &quot;shipped&quot;,<br>  customerId: &quot;C-4821&quot;,<br>  createdAt: { $gte: ISODate(&quot;2024-01-01&quot;) }<br>}).sort({ createdAt: -1 }).explain(&quot;executionStats&quot;)</pre><p>The explain output:</p><pre>{<br>  &quot;explainVersion&quot;: 2,<br>  &quot;command&quot;: &quot;db.runCommand({explain: { &#39;find&#39; : &#39;orders&#39;, &#39;filter&#39; : { &#39;status&#39; : &#39;shipped&#39;, &#39;customerId&#39; : &#39;C-4821&#39;, &#39;createdAt&#39; : { &#39;$gte&#39; : ISODate(&#39;2024-01-01T00:00:00Z&#39;) } }, &#39;sort&#39; : { &#39;createdAt&#39; : -1 } }})&quot;,<br>  &quot;explainCommandPlanningTimeMillis&quot;: 0.644,<br>  &quot;explainCommandExecTimeMillis&quot;: 81.374,<br>  &quot;queryPlanner&quot;: {<br>    &quot;namespace&quot;: &quot;db.orders&quot;,<br>    &quot;winningPlan&quot;: {<br>      &quot;stage&quot;: &quot;PARALLEL_SORT_MERGE&quot;,<br>      &quot;startupCost&quot;: 36640.95,<br>      &quot;totalCost&quot;: 40692.13,<br>      &quot;workersPlanned&quot;: 2,<br>      &quot;estimatedTotalKeysExamined&quot;: 34722,<br>      &quot;inputStage&quot;: {<br>        &quot;stage&quot;: &quot;SORT&quot;,<br>        &quot;startupCost&quot;: 35640.93,<br>        &quot;totalCost&quot;: 35684.33,<br>        &quot;sortKeysCount&quot;: 1,<br>        &quot;sortKey&quot;: [<br>          {<br>            &quot;createdAt&quot;: -1<br>          }<br>        ],<br>        &quot;estimatedTotalKeysExamined&quot;: 17361,<br>        &quot;inputStage&quot;: {<br>          &quot;stage&quot;: &quot;COLLSCAN&quot;,<br>          &quot;startupCost&quot;: 0,<br>          &quot;totalCost&quot;: 34418.4,<br>          &quot;runtimeFilterSet&quot;: [<br>            {<br>              &quot;status&quot;: {<br>                &quot;$eq&quot;: &quot;shipped&quot;<br>              }<br>            },<br>            {<br>              &quot;customerId&quot;: {<br>                &quot;$eq&quot;: &quot;C-4821&quot;<br>              }<br>            },<br>            {<br>              &quot;createdAt&quot;: {<br>                &quot;$gte&quot;: {<br>                  &quot;$date&quot;: &quot;2024-01-01T00:00:00Z&quot;<br>                }<br>              }<br>            }<br>          ],<br>          &quot;estimatedTotalKeysExamined&quot;: 17361<br>        }<br>      }<br>    }<br>  },<br>  &quot;executionStats&quot;: {<br>    &quot;nReturned&quot;: 18,<br>    &quot;executionTimeMillis&quot;: 81.312,<br>    &quot;executionStartAtTimeMillis&quot;: 79.32900000000001,<br>    &quot;totalDocsExamined&quot;: 18,<br>    &quot;totalKeysExamined&quot;: 18,<br>    &quot;executionStages&quot;: {<br>      &quot;stage&quot;: &quot;PARALLEL_SORT_MERGE&quot;,<br>      &quot;nReturned&quot;: 18,<br>      &quot;executionTimeMillis&quot;: 81.312,<br>      &quot;executionStartAtTimeMillis&quot;: 79.32900000000001,<br>      &quot;totalDocsExamined&quot;: 18,<br>      &quot;totalKeysExamined&quot;: 18,<br>      &quot;numBlocksFromCache&quot;: 25076,<br>      &quot;parallelWorkers&quot;: 2,<br>      &quot;inputStage&quot;: {<br>        &quot;stage&quot;: &quot;SORT&quot;,<br>        &quot;nReturned&quot;: 6,<br>        &quot;executionTimeMillis&quot;: 71.656,<br>        &quot;executionStartAtTimeMillis&quot;: 71.655,<br>        &quot;totalDocsExamined&quot;: 6,<br>        &quot;totalKeysExamined&quot;: 6,<br>        &quot;sortMethod&quot;: &quot;quicksort&quot;,<br>        &quot;totalDataSizeSortedBytesEstimate&quot;: 25,<br>        &quot;numBlocksFromCache&quot;: 25076,<br>        &quot;inputStage&quot;: {<br>          &quot;stage&quot;: &quot;COLLSCAN&quot;,<br>          &quot;nReturned&quot;: 6,<br>          &quot;executionTimeMillis&quot;: 71.595,<br>          &quot;executionStartAtTimeMillis&quot;: 10.154,<br>          &quot;totalDocsExamined&quot;: 333333,<br>          &quot;totalKeysExamined&quot;: 6,<br>          &quot;totalDocsRemovedByRuntimeFilter&quot;: 333327,<br>          &quot;numBlocksFromCache&quot;: 25000<br>        }<br>      }<br>    }<br>  },<br>  &quot;ok&quot;: 1<br>}</pre><p>Considering the <em>executionTimeMillis </em>alone, the query looks good and returns the results in a few milliseconds, but let’s look at some key fields in the output:</p><ul><li><strong>stage: “COLLSCAN”: </strong>Full collection scan, no index used</li><li><strong>totalDocsExamined: </strong>How many docs were scanned</li><li><strong>totalKeysExamined: </strong>How many index keys were examined</li><li><strong>nReturned: </strong>How many docs matched</li><li><strong>executionTimeMillis: </strong>Total execution time</li></ul><p><strong>Red flag output:</strong></p><pre>&quot;stage&quot;: &quot;COLLSCAN&quot;,<br>&quot;totalDocsExamined&quot;: 333333,<br>&quot;nReturned&quot;: 18,<br>&quot;executionTimeMillis&quot;: 81.312</pre><p>Scanned <strong>333K documents</strong> to return <strong>18 </strong>(top stage). That’s a 99.99% waste.</p><p><strong>— -</strong></p><p><strong>Step 2 — Add a Naive Index (and Why It’s Not Enough)</strong></p><p>Your first instinct might be:</p><pre>db.orders.createIndex({ status: 1 })</pre><p>Run <em>explain()</em> again:</p><pre>&quot;inputStage&quot;: {<br>  &quot;stage&quot;: &quot;IXSCAN&quot;,<br>  &quot;nReturned&quot;: 249800,<br>  &quot;executionTimeMillis&quot;: 22.078,<br>  &quot;executionStartAtTimeMillis&quot;: 22.077,<br>  &quot;indexName&quot;: &quot;status_1&quot;,<br>  &quot;indexUsage&quot;: {<br>    &quot;scanLoops&quot;: 249800,<br>    &quot;scanType&quot;: &quot;regular&quot;,<br>    &quot;scanKeys&quot;: [<br>      &quot;key 1: [(isInequality: false, estimatedEntryCount: 250172)]&quot;<br>    ]<br>  },<br>  &quot;totalKeysExamined&quot;: 249800,<br>  &quot;numBlocksFromCache&quot;: 70<br>}</pre><p>Better — now it’s an index scan (‘IXSCAN’). But we’re still scanning <strong>249K index keys</strong> to return 18 results. The index on ‘status’ narrowed the field, but it didn’t help with ‘customerId’ or ‘createdAt’.</p><p>The sort still happens <strong>in memory</strong> (‘SORT’ stage after ‘IXSCAN’), which can be expensive.</p><p><strong>— -</strong></p><p><strong>Step 3 — Apply the ESR Rule</strong></p><p>The <strong>ESR rule</strong> is the golden standard for designing compound indexes:</p><p>&gt; <strong>E</strong>quality → <strong>S</strong>ort → <strong>R</strong>ange</p><p>Fields used in <strong>equality filters</strong> come first, followed by fields used in <strong>sort</strong>, and finally fields used in <strong>range filters</strong>.</p><p>For our query:</p><p>- <strong>Equality</strong>: ‘status’ (“shipped”) and ‘customerId’ (“C-4821”) — exact matches</p><p>- <strong>Sort</strong>: ‘createdAt’ — the sort direction</p><p>- <strong>Range</strong>: ‘createdAt’ — the ‘$gte’ filter</p><p>Since ‘createdAt’ is used in both sort and range, it appears once, in the sort position (which also satisfies the range scan naturally):</p><pre>db.orders.createIndex({ customerId: 1, status: 1, createdAt: -1 })</pre><p><strong>Why this order?</strong></p><p>1. ‘customerId’ comes first because it is the most <strong>selective</strong> equality field — it narrows the result set the most aggressively, so the index skips the vast majority of entries immediately</p><p>2. ‘status’ follows as a secondary equality filter, further narrowing the remaining entries</p><p>3. ‘createdAt: -1’ matches the sort direction, so the engine can <strong>walk the index in order</strong> instead of sorting in memory</p><p>4. The range filter on ‘createdAt’ is applied last, on an already-narrow result set</p><p>&gt; <strong>Tip:</strong> Within the equality group, always place the most selective field first. A field like ‘customerId’ (high cardinality — thousands of distinct values) will skip far more entries than ‘status’ (low cardinality — only a handful of values like “shipped”, “pending”, “cancelled”). Note that ‘customerId’ is not unique here since a customer can have many orders, but it is still far more selective than ‘status’.</p><p>Run <em>explain()</em> one more time:</p><pre>{<br>  &quot;explainVersion&quot;: 2,<br>  &quot;command&quot;: &quot;db.runCommand({explain: { &#39;find&#39; : &#39;orders&#39;, &#39;filter&#39; : { &#39;status&#39; : &#39;shipped&#39;, &#39;customerId&#39; : &#39;C-4821&#39;, &#39;createdAt&#39; : { &#39;$gte&#39; : ISODate(&#39;2024-01-01T00:00:00Z&#39;) } }, &#39;sort&#39; : { &#39;createdAt&#39; : -1 } }})&quot;,<br>  &quot;explainCommandPlanningTimeMillis&quot;: 29.028000000000002,<br>  &quot;explainCommandExecTimeMillis&quot;: 0.10200000000000001,<br>  &quot;queryPlanner&quot;: {<br>    &quot;namespace&quot;: &quot;db.orders&quot;,<br>    &quot;winningPlan&quot;: {<br>      &quot;stage&quot;: &quot;FETCH&quot;,<br>      &quot;ns&quot;: &quot;db.orders&quot;,<br>      &quot;startupCost&quot;: 0,<br>      &quot;totalCost&quot;: 2.01,<br>      &quot;estimatedTotalKeysExamined&quot;: 41667,<br>      &quot;inputStage&quot;: {<br>        &quot;stage&quot;: &quot;IXSCAN&quot;,<br>        &quot;ns&quot;: &quot;db.orders&quot;,<br>        &quot;indexName&quot;: &quot;customerId_1_status_1_createdAt_-1&quot;,<br>        &quot;direction&quot;: &quot;Forward&quot;,<br>        &quot;indexUsage&quot;: {<br>          &quot;indexKeyString&quot;: &quot;{\&quot;customerId\&quot;: 1,\&quot;status\&quot;: 1,\&quot;createdAt\&quot;: -1}&quot;,<br>          &quot;isMultiKey&quot;: false,<br>          &quot;bounds&quot;: [<br>            &quot;[\&quot;customerId\&quot;: [\&quot;C-4821\&quot;, \&quot;C-4821\&quot;], \&quot;status\&quot;: [\&quot;shipped\&quot;, \&quot;shipped\&quot;], \&quot;createdAt\&quot;: DESC[{ \&quot;$date\&quot; : \&quot;2024-01-01T00:00:00Z\&quot; }, { \&quot;$date\&quot; : \&quot;292278994-08-17T07:12:55.807Z\&quot; }]]&quot;<br>          ]<br>        },<br>        &quot;startupCost&quot;: 0,<br>        &quot;totalCost&quot;: 2.01,<br>        &quot;hasOrderBy&quot;: true,<br>        &quot;indexFilterSet&quot;: [<br>          {<br>            &quot;status&quot;: {<br>              &quot;$eq&quot;: &quot;shipped&quot;<br>            }<br>          },<br>          {<br>            &quot;customerId&quot;: {<br>              &quot;$eq&quot;: &quot;C-4821&quot;<br>            }<br>          },<br>          {<br>            &quot;createdAt&quot;: {<br>              &quot;$gte&quot;: {<br>                &quot;$date&quot;: &quot;2024-01-01T00:00:00Z&quot;<br>              }<br>            }<br>          }<br>        ],<br>        &quot;estimatedTotalKeysExamined&quot;: 41667<br>      }<br>    },<br>    &quot;indexCosts&quot;: [<br>      {<br>        &quot;namespace&quot;: &quot;db.orders&quot;,<br>        &quot;costs&quot;: [<br>          {<br>            &quot;indexName&quot;: &quot;_id_&quot;,<br>            &quot;startupCost&quot;: 0.425,<br>            &quot;totalCost&quot;: 19644.425,<br>            &quot;selectivity&quot;: 1,<br>            &quot;correlation&quot;: 0.75,<br>            &quot;estimatedPercentIndexPagesLoaded&quot;: 100,<br>            &quot;estimatedTotalIndexEntries&quot;: 1000000,<br>            &quot;boundarySelectivity&quot;: 1<br>          }<br>        ]<br>      }<br>    ]<br>  },<br>  &quot;executionStats&quot;: {<br>    &quot;nReturned&quot;: 18,<br>    &quot;executionTimeMillis&quot;: 0.058,<br>    &quot;executionStartAtTimeMillis&quot;: 0.036000000000000004,<br>    &quot;totalDocsExamined&quot;: 18,<br>    &quot;totalKeysExamined&quot;: 18,<br>    &quot;executionStages&quot;: {<br>      &quot;stage&quot;: &quot;FETCH&quot;,<br>      &quot;nReturned&quot;: 18,<br>      &quot;executionTimeMillis&quot;: 0.058,<br>      &quot;executionStartAtTimeMillis&quot;: 0.036000000000000004,<br>      &quot;totalKeysExamined&quot;: 18,<br>      &quot;numBlocksFromCache&quot;: 25,<br>      &quot;inputStage&quot;: {<br>        &quot;stage&quot;: &quot;IXSCAN&quot;,<br>        &quot;nReturned&quot;: 18,<br>        &quot;executionTimeMillis&quot;: 0.058,<br>        &quot;executionStartAtTimeMillis&quot;: 0.036000000000000004,<br>        &quot;indexName&quot;: &quot;customerId_1_status_1_createdAt_-1&quot;,<br>        &quot;indexUsage&quot;: {<br>          &quot;scanLoops&quot;: 19,<br>          &quot;scanType&quot;: &quot;ordered&quot;,<br>          &quot;scanKeys&quot;: [<br>            &quot;key 1: [(isInequality: true, estimatedEntryCount: 18)]&quot;<br>          ]<br>        },<br>        &quot;totalKeysExamined&quot;: 18,<br>        &quot;numBlocksFromCache&quot;: 25<br>      }<br>    }<br>  },<br>  &quot;ok&quot;: 1<br>}</pre><p><strong>18 keys examined, 18 returned, 0.058ms, zero in-memory sort.</strong> That’s what an efficient query looks like.</p><p><strong>— -</strong></p><p><strong>Step 4 — Confirm the Sort is Index-Backed</strong></p><p>Look for the absence of a ‘SORT’ stage in the winning plan. A plan like this is ideal:</p><p>FETCH</p><p>└── IXSCAN { customerId: 1, status: 1, createdAt: -1 }</p><p>If you see this instead, the sort is still in memory:</p><p>SORT</p><p>└── FETCH</p><p>└── IXSCAN { status: 1 }</p><p>The ESR-ordered compound index eliminates the in-memory sort because the index already delivers documents in the right order.</p><p><strong>— -</strong></p><p><strong>Step 5 — Go Further with Covered Queries</strong></p><p>Even with a perfect ‘IXSCAN’, the engine still performs a ‘FETCH’ — it reads the index to find matching keys, then goes back to the collection to retrieve the full document. For high-throughput queries, eliminating this fetch is the next level of optimization.</p><p>A <strong>covered query</strong> is one where the index contains <em>all</em> the fields the query needs — filters, sort, and projected output. The engine never touches the documents themselves.</p><p>Add a projection that only returns fields already in the index:</p><pre>db.orders.find(<br>  {<br>    status: &quot;shipped&quot;,<br>    customerId: &quot;C-4821&quot;,<br>    createdAt: { $gte: ISODate(&quot;2024-01-01&quot;) }<br>  },<br>  { _id: 0, customerId: 1, status: 1, createdAt: 1 }<br>).sort({ createdAt: -1 }).explain(&quot;executionStats&quot;)</pre><p>The winning plan now looks like:</p><p>IXSCAN { customerId: 1, status: 1, createdAt: -1 }</p><p>No ‘FETCH’ stage at all. The query is fully served by the index.</p><pre>&quot;stage&quot;: &quot;IXSCAN&quot;,<br>&quot;totalKeysExamined&quot;: 18,<br>&quot;nReturned&quot;: 18,<br>&quot;executionTimeMillis&quot;: 0.053</pre><p>&gt; <strong>When is this worth it?</strong> Covered queries shine on high-read collections where the same query runs thousands of times per second and the projected fields are a small subset of a wide document. If you need the full document anyway, the FETCH is unavoidable.</p><p><strong>— -</strong></p><h4><strong>Common Mistakes to Avoid</strong></h4><p><strong>Putting range fields first</strong></p><p>❌ Wrong — range before equality</p><p><em>db.orders.createIndex({ createdAt: -1, customerId: 1, status: 1 })</em></p><p>This forces the engine to scan a wide range of dates before applying the equality filters.</p><p><strong>Mismatching directions in a multi-field sort</strong></p><p>To ensure maximum index utilization, the sort specification must match both the <strong>fields and their directions</strong> as declared in the index — <strong>or</strong> be the <strong>complete reverse</strong> of the index.</p><p>Given the index { a: 1, b: -1 }:</p><p>- .sort({ a: 1, b: -1 }) → Full index-based sort (forward scan)</p><p>- .sort({ a: -1, b: 1 }) → Full index-based sort (reverse scan)</p><p>- .sort({ a: 1, b: 1 }) → Partial — only ‘a’ uses the index; ‘b’ sorted in memory</p><p>- .sort({ a: 1 }) → Partial — only ‘a’ uses the index</p><p>&gt; <strong>Tip:</strong> Sorts that don’t fully match the index order still benefit from <strong>partial (incremental) ordering</strong> — the index handles what it can, and the database completes the remaining fields in memory.</p><p><strong>Over-indexing</strong></p><p>Every index costs write performance and storage. Create indexes for your actual query patterns, not preemptively.</p><p><strong>— -</strong></p><p><strong>Quick Reference: ESR Checklist</strong></p><p>Before creating a compound index, answer these three questions:</p><p>1. Which fields use <strong>exact match</strong> ($eq)? → Put them <strong>first</strong></p><p>2. Which field is used in <strong>sort()</strong>? → Put it <strong>in the middle</strong></p><p>3. Which fields use <strong>range operators</strong> ($gt, $lt, $gte, $lte, $in)? → Put them <strong>last</strong></p><p><strong>— -</strong></p><p><strong>Summary</strong></p><p>- <strong>Diagnostic Logs + Log Analytics</strong> — Identifies slow queries in production before they become incidents</p><p>- <strong>Replace COLLSCAN with IXSCAN</strong> — Eliminates full collection scan</p><p>- <strong>Apply ESR rule to compound index</strong> — Narrows key scans to near-exact matches</p><p>- <strong>Match index direction to sort</strong> — Eliminates expensive in-memory sort</p><p>- <strong>Use covered queries (projection)</strong> — Eliminates the FETCH stage — index serves the full query</p><p>A single well-designed index transformed an 81.3ms query into a 0.053ms one without application code changes required. With fewer resources consumed per query, your application gains more headroom to scale and can handle higher request rates without adding infrastructure.</p><p><strong>— -</strong></p><p><em>*Next in this series: Optimizing Aggregation Pipelines in Azure DocumentDB — stage ordering, early filtering, and more.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3035842e4dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>