Em 22 de julho de 2010 17:17, Euler Taveira de Oliveira
<[email protected]>escreveu:
>
> limiar_vacuum = autovacuum_vacuum_threshold +
> autovacuum_vacuum_scale_factor *
> reltuples
>
> O autovacuum faz:
>
> if (pg_stat_*_tables.n_dead_tup > limiar_vacuum)
> execute o VACUUM
>
> O mesmo vale para o ANALYZE.
>
>
Caso vc queira "escovar bits" e verificar na prática o que o Euler disse
veja o fonte [1] do PostgreSQL mais ou menos na linha 2604:
if (PointerIsValid(tabentry))
{
reltuples = classForm->reltuples;
vactuples = tabentry->n_dead_tuples;
anltuples = tabentry->n_live_tuples + tabentry->n_dead_tuples -
tabentry->last_anl_tuples;
vacthresh = (float4) vac_base_thresh + vac_scale_factor * reltuples;
anlthresh = (float4) anl_base_thresh + anl_scale_factor * reltuples;
/*
* Note that we don't need to take special consideration for stat
* reset, because if that happens, the last vacuum and analyze counts
* will be reset too.
*/
elog(DEBUG3, "%s: vac: %.0f (threshold %.0f), anl: %.0f (threshold
%.0f)",
NameStr(classForm->relname),
vactuples, vacthresh, anltuples, anlthresh);
/* Determine if this table needs vacuum or analyze. */
*dovacuum = force_vacuum || (vactuples > vacthresh);
*doanalyze = (anltuples > anlthresh);
[1] src/backend/postmaster/autovacuum.c
--
Fabrízio de Royes Mello
>> Blog sobre TI: http://fabriziomello.blogspot.com
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral