Analyze not doing anything? - Mailing list pgsql-general

From Jim C. Nasby
Subject Analyze not doing anything?
Date
Msg-id 20040205192043.GK32360@nasby.net
Whole thread Raw
Responses Re: Analyze not doing anything?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I build a table to test the theory that PGSQL wouldn't use an index to
satisfy 'SELECT * FROM table WHERE field IS NOT NULL'. Sure enough it
wasn't using the index, but it seems that's because there's no stats to
be had. What am I doing wrong? This is version 7.3.4.

stats=# \t
Showing only tuples.
stats=# select * from pg_stats where tablename='t';

stats=# analyze t;
ANALYZE
stats=# select * from pg_stats where tablename='t';

stats=# select count(*) from pg_stats where tablename='email_contrib';
     5
stats=# \t
Tuples only is off.
stats=# select relname, relpages, reltuples from pg_class where relname ='moo' or relname='t';
 relname | relpages | reltuples
---------+----------+-----------
 moo     |      289 |    131073
 t       |    32769 |    131076
(2 rows)

stats=# \d t
            Table "public.t"
 Column |      Type       |  Modifiers
--------+-----------------+-------------
 i      | integer         |
 c      | character(1950) | default 'x'
Indexes: moo btree (i)

stats=#

--
Jim C. Nasby, Database Consultant                  jim@nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_restore and large files
Next
From: Tom Lane
Date:
Subject: Re: Functions in CHECK constraint not getting dumped before