Re: When was ANALYZE run in the past?

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Benjamin Rutt <rutt(dot)4(at)osu(dot)edu>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: When was ANALYZE run in the past?
Date: 2014-11-29 20:35:22
Message-ID: 20141129153522.fb034d714ee7407d7f06dd67@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 29 Nov 2014 15:27:07 -0500
Benjamin Rutt <rutt(dot)4(at)osu(dot)edu> wrote:

> On *https://wiki.postgresql.org/wiki/Slow_Counting*
> <https://wiki.postgresql.org/wiki/Slow_Counting> I read that
>
> SELECT reltuples FROM pg_class WHERE relname = 'tbl';
>
> may be a good way to get an estimate of the # of rows in the table, but
> depends on how frequently ANALYZE has been running. I run autovacuum under
> a default configuration, but I suspect ANALYZE is not running frequently
> enough for my purposes (when I ran the above command on my table, it
> consistently returned 1.4 million for ~20 minutes straight; when I
> explicitly ran an ANALYZE command at that point (when I realized the
> estimate was not updating even every few minutes), the ANALYZE command took
> a few seconds, then the above command returned .7 million which matches
> what ?select count(*)? was returning). So I suspect ANALYZE is not running
> frequently enough or is stepping over my table for some reason.
>
> So, given the above context, my question is, is there any way to tell at
> what times ANALYZE has been run in the past on the db or on a particular
> table? I am running a fairly vanilla postgres 8.4 db on linux, with a few
> minor tweaks to postgresql.conf:

I would tell you to look at the pg_stat_all_tables view, but I'm not even sure
if the ancient, unsupported 8.4 version of PostgreSQL had that table.

--
Bill Moran
I need your help to succeed:
http://gamesbybill.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message CS DBA 2014-11-29 21:37:56 recovering from "too many failures" wal error
Previous Message Benjamin Rutt 2014-11-29 20:27:07 When was ANALYZE run in the past?