Chapter 64. How the Planner Uses Statistics

Table of Contents

64.1. Row Estimation Examples
64.2. Multivariate Statistics Examples
64.2.1. Functional Dependencies
64.2.2. Multivariate N-Distinct Counts
64.2.3. MCV Lists
64.3. Planner Statistics and Security

This chapter builds on the material covered in Section 15.1 and Section 15.2 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.