Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 40D40475D4B for ; Mon, 6 Jan 2003 16:16:15 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 4EA9D475CA9 for ; Mon, 6 Jan 2003 16:16:14 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h06LGB0U003065; Mon, 6 Jan 2003 16:16:11 -0500 (EST) To: Jeff Boes Cc: pgsql-admin@postgresql.org Subject: Re: ANALYZE not working? In-reply-to: References: Comments: In-reply-to Jeff Boes message dated "Mon, 06 Jan 2003 15:52:21 -0500" Date: Mon, 06 Jan 2003 16:16:11 -0500 Message-ID: <3064.1041887771@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/44 X-Sequence-Number: 6886 Jeff Boes writes: > This is just way too weird: > $ psql > # select count(*) from stat_fetch; > count > -------- > 143243 > (1 row) > (Big table, two indexes.) > # analyze stat_fetch; > ANALYZE > (That should update all the stats, right?) > # select relname, reltuples from pg_class > # where relname = 'stat_fetch'; > relname | reltuples > ------------+----------- > stat_fetch | 3419 > (1 row) > (Wha? Huh?) Have you done VACUUM FULL on this table in living memory? The current implementation of ANALYZE can get fooled if the table has very nonuniform tuple density (eg, lots of empty or near-empty pages near the beginning, and filled pages near the end). I'd try "vacuum full verbose stat_fetch" and note whether it shrinks the table a lot. (If it does, that suggests that you need more frequent regular vacuums, and/or larger FSM settings in postgresql.conf.) regards, tom lane