Thread: vacuum tip question

vacuum tip question

From
Joost Kraaijeveld
Date:
Hi,

I am using auto-vacuum (autovacuum = on) but sometimes PGAdmin warns me
that I need to enable autovacuum or do it manually.

How does PgAdmin determine that it is necessary to run vacuum?

TIA

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl


Re: vacuum tip question

From
Dave Page
Date:
Joost Kraaijeveld wrote:
> Hi,
> 
> I am using auto-vacuum (autovacuum = on) but sometimes PGAdmin warns me
> that I need to enable autovacuum or do it manually.
> 
> How does PgAdmin determine that it is necessary to run vacuum?

Using the following code:

bool pgTable::GetVacuumHint()
{    bool canHint=false;
    if (rowsCounted) // We've explicitly counted the rows    {        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;
 
}

Regards, Dave