Re: pgAdmin complains about vacuuming required after fresh 8.1 install - Mailing list pgsql-general

From Dave Page
Subject Re: pgAdmin complains about vacuuming required after fresh 8.1 install
Date
Msg-id 937d27e10806120123t16532a5ds4c214e067319f3f2@mail.gmail.com
Whole thread Raw
In response to Re: pgAdmin complains about vacuuming required after fresh 8.1 install  ("Collin Peters" <cadiolis@gmail.com>)
List pgsql-general
On Thu, Jun 12, 2008 at 7:18 AM, Collin Peters <cadiolis@gmail.com> wrote:
> Bump
>
> Does anyone have *any* thoughts on this?  This seems to be a fairly
> common problem.  Does anybody have any good links that they can
> provide to find an answer?
>
> My current test is that I have a table where all the rows were purged,
> and then new ones inserted using a specific job.  pgAdmin reports 0
> estimated rows and 46 counted rows and therefore displays the popup
> saying a vacuum should be run.  I see in the PostgreSQL log that
> autovacuum is vacuuming this database regularly.
>
> Is this simply because pgAdmin has tighter settings and autovacuum
> hasn't actually done anything with this table yet?
>

pgAdmin's code for that is far older than PostgreSQL's:

bool pgTable::GetVacuumHint()
{
    bool canHint=false;

    if (rowsCounted)
    {
        if (!estimatedRows || (estimatedRows == 1000 &&
rows.GetValue() != 1000))
            canHint = (rows >= 20);
        else
        {
            double rowsDbl=(wxLongLong_t)rows.GetValue();
            double quot=rowsDbl *10. / estimatedRows;
            canHint = ((quot > 12 || quot < 8) && (rowsDbl <
estimatedRows-20. || rowsDbl > estimatedRows+20.));
        }
    }
    else if (estimatedRows == 1000)
    {
        canHint = true;
    }
    return canHint;
}

in there, estimatedRows is the number of rows noted in the pg_class
entry, and rows is the number of rows actually counted in the table,
if rowsCounted is true (which will be the case if you've forced a
count from the menu, or the row count threshold (under File ->
Options) is >= estimatedRows) .

Suggestions for improvements are welcome.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com

pgsql-general by date:

Previous
From: Giorgio Valoti
Date:
Subject: to_tsvector: error with italian configuration
Next
From: "A. Kretschmer"
Date:
Subject: Re: pl/pgsql function with argument of type DATE