- One component of the statistics is the total number of entries in each
- table and index, as well as the number of disk blocks occupied by each
- table and index. This information is kept in the table
- pg_class in the columns reltuples
- and relpages. We can look at it
- with queries similar to this one:
+ One component of the statistics is the total number of entries in
+ each table and index, as well as the number of disk blocks occupied
+ by each table and index. This information is kept in the table
+ pg_class, in
+ the columns reltuples and
+ relpages. We can look at it with
+ queries similar to this one:
SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 'tenk1%';
Most queries retrieve only a fraction of the rows in a table, due
- to having WHERE> clauses that restrict the rows to be examined.
- The planner thus needs to make an estimate of the
- selectivity> of WHERE> clauses, that is, the fraction of
- rows that match each condition in the WHERE> clause. The information
- used for this task is stored in the pg_statistic
- system catalog. Entries in pg_statistic are
- updated by ANALYZE> and VACUUM ANALYZE> commands
- and are always approximate even when freshly updated.
+ to having WHERE> clauses that restrict the rows to be
+ examined. The planner thus needs to make an estimate of the
+ selectivity> of WHERE> clauses, that is,
+ the fraction of rows that match each condition in the
+ WHERE> clause. The information used for this task is
+ stored in the pg_statistic
+ system catalog. Entries in pg_statistic
+ are updated by the ANALYZE> and VACUUM
+ ANALYZE> commands and are always approximate even when freshly
+ updated.