Chapter 72. How the Planner Uses Statistics

|Chapter 72. How the Planner Uses Statistics|                    |                   |                  |                                     |
|:-----------------------------------------:|--------------------|-------------------|------------------|-------------------------------------|
|         [Prev](bki-example.html)          |[Up](internals.html)|Part VII. Internals|[Home](index.html)| [Next](row-estimation-examples.html)|

---

## Chapter 72. How the Planner Uses Statistics

**Table of Contents**

[72.1. Row Estimation Examples](row-estimation-examples.html)[72.2. Multivariate Statistics Examples](multivariate-statistics-examples.html)[72.2.1. Functional Dependencies](multivariate-statistics-examples.html#FUNCTIONAL-DEPENDENCIES)[72.2.2. Multivariate N-Distinct Counts](multivariate-statistics-examples.html#MULTIVARIATE-NDISTINCT-COUNTS)[72.2.3. MCV Lists](multivariate-statistics-examples.html#MCV-LISTS)[72.3. Planner Statistics and Security](planner-stats-security.html)

 This chapter builds on the material covered in [Section 14.1](using-explain.html) and [Section 14.2](planner-stats.html) to show some additional details about how the planner uses the system statistics to estimate the number of rows each part of a query might return. This is a significant part of the planning process, providing much of the raw material for cost calculation.

 The intent of this chapter is not to document the code in detail, but to present an overview of how it works. This will perhaps ease the learning curve for someone who subsequently wishes to read the code.

---

|[Prev](bki-example.html)|[Up](internals.html)| [Next](row-estimation-examples.html)|
|:-----------------------|:------------------:|------------------------------------:|
|   71.6. BKI Example    | [Home](index.html) |    72.1. Row Estimation Examples    |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>