On a number of my tables, "analyze" seems to be putting the wrong value of
"reltuples" in pg_class. "vacuum" seems to be doing the right thing.
An example of the failure mode is shown below. Please let me know what
additional info I could supply if more info would help.
Ron
logs2=# select count(*) from e_ip_full;
count
---------
1697755
(1 row)
logs2=# analyze e_ip_full;
logs2=# select relname,reltuples from pg_class where relname = 'e_ip_full';
relname | reltuples
-----------+-----------
e_ip_full | 7555
(1 row)
logs2=# vacuum e_ip_full;
VACUUM
logs2=# select relname,reltuples from pg_class where relname = 'e_ip_full';
relname | reltuples
-----------+-------------
e_ip_full | 1.69776e+06
(1 row)
logs2=# analyze verbose e_ip_full;
NOTICE: Analyzing e_ip_full
ANALYZE
logs2=# select relname,reltuples from pg_class where relname = 'e_ip_full';
relname | reltuples
-----------+-----------
e_ip_full | 7555
(1 row)
logs2=# \d e_ip_full;
Table "e_ip_full"
Column | Type | Modifiers
----------+-------------------------+-----------
ip | character varying(16) |
dat | date |
dom1 | character varying(255) |
dom2 | character varying(255) |
dom3 | character varying(255) |
dom4 | character varying(255) |
domn | character varying(1024) |
obsolete | boolean |
Indexes: e_ip__domain
Unique keys: e_ip__ip_obsolete_dat
logs2=#