PostgreSQL 8.2.4 Documentation
Prev | Fast Backward |  | Fast Forward | Next

# Chapter 54. How the Planner Uses Statistics

This chapter builds on the material covered in Section 13.1 and Section 13.2, and shows how the planner uses the system statistics to estimate the number of rows each stage in a query might return. This is a significant part of the planning / optimizing process, providing much of the raw material for cost calculation.

The intent of this chapter is not to document the code — better done in the code itself, 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. As a consequence, the approach chosen is to analyze a series of incrementally more complex examples.

The outputs and algorithms shown below are taken from version 8.0. The behavior of earlier (or later) versions may vary.

Prev | Home | Next
Example | Up | Row Estimation Examples