Subject: vacuum command functions

From: [email-masked] (Paul Brunner)
Date: Fri, 8 Jul 94 12:34:09 EDT

In the 4.2 release of POSTGRES from Berkeley, there is a vacuum command,
one of whose stated purposes is to update statistics on the database used by
the query optimizer to select the best execution plan.

I was reading a paper comparing university POSTGRES with the database system
produced by Illustra Software, Inc. (a commercialization of the POSTGRES
research software.) In the paper, it states that the POSTGRES vacuum command
never actually updates these statistics. Tests I've run show the attributes
of "relpages" and "reltuples" being updated by running the vacuum after
appending rows to classes.

Does the vacuum command indeed update the statistics to reflect the current 
state of the database, regardless of whatever kind of alterations have been
made to the data?

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================

---

From: Mike Olson <[email-masked]>
Date: Fri, 08 Jul 94 09:47:25 -0700

> appending rows to classes.

the short answer is that the university system records the number of
tuples and disk pages in a relation.  the commercial system records those
two things, plus some more info about the number of distinct values and
the range of values for each column in a relation.  the additional info
would go into the table 'pg_statistics', if the university system collected
it.

number of tuples and disk pages are useful -- they'll convince the
optimizer to use an index for a scan, if one exists.  however, depending
on the distribution of values in a column, using the index might be a
bad idea.
					mike