1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 69. How the Planner Uses Statistics</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="bki-example.html" title="68.6. BKI Example" /><link rel="next" href="row-estimation-examples.html" title="69.1. Row Estimation Examples" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 69. How the Planner Uses Statistics</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="bki-example.html" title="68.6. BKI Example">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="internals.html" title="Part VII. Internals">Up</a></td><th width="60%" align="center">Part VII. Internals</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="row-estimation-examples.html" title="69.1. Row Estimation Examples">Next</a></td></tr></table><hr /></div><div class="chapter" id="PLANNER-STATS-DETAILS"><div class="titlepage"><div><div><h2 class="title">Chapter 69. How the Planner Uses Statistics</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="row-estimation-examples.html">69.1. Row Estimation Examples</a></span></dt><dt><span class="sect1"><a href="multivariate-statistics-examples.html">69.2. Multivariate Statistics Examples</a></span></dt><dd><dl><dt><span class="sect2"><a href="multivariate-statistics-examples.html#FUNCTIONAL-DEPENDENCIES">69.2.1. Functional Dependencies</a></span></dt><dt><span class="sect2"><a href="multivariate-statistics-examples.html#MULTIVARIATE-NDISTINCT-COUNTS">69.2.2. Multivariate N-Distinct Counts</a></span></dt><dt><span class="sect2"><a href="multivariate-statistics-examples.html#MCV-LISTS">69.2.3. MCV Lists</a></span></dt></dl></dd><dt><span class="sect1"><a href="planner-stats-security.html">69.3. Planner Statistics and Security</a></span></dt></dl></div><p>
3 This chapter builds on the material covered in <a class="xref" href="using-explain.html" title="14.1. Using EXPLAIN">Section 14.1</a> and <a class="xref" href="planner-stats.html" title="14.2. Statistics Used by the Planner">Section 14.2</a> to show some
4 additional details about how the planner uses the
5 system statistics to estimate the number of rows each part of a query might
6 return. This is a significant part of the planning process,
7 providing much of the raw material for cost calculation.
9 The intent of this chapter is not to document the code in detail,
10 but to present an overview of how it works.
11 This will perhaps ease the learning curve for someone who subsequently
12 wishes to read the code.
13 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bki-example.html" title="68.6. BKI Example">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="internals.html" title="Part VII. Internals">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="row-estimation-examples.html" title="69.1. Row Estimation Examples">Next</a></td></tr><tr><td width="40%" align="left" valign="top">68.6. BKI Example </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 69.1. Row Estimation Examples</td></tr></table></div></body></html>