Re: another autovacuum scheduling thread

Поиск
Список
Период
Сортировка
От wenhui qiu
Тема Re: another autovacuum scheduling thread
Дата
Msg-id CAGjGUA+2VjT0GR0m+6GOkTxEGv6s92+8AeF=8Vwy1xeZSDtc=A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: another autovacuum scheduling thread  (Sami Imseih <samimseih@gmail.com>)
Ответы Re: another autovacuum scheduling thread
Список pgsql-hackers
HI Nathan Bossart 

> + if (vactuples > vacthresh)
> + {
> + *dovacuum = true;
> + *score = Max(*score, (double) vactuples / Max(vacthresh, 1));
> + }
> +
> + if (vac_ins_base_thresh >= 0 && instuples > vacinsthresh)
> + {
> + *dovacuum = true;
> + *score = *score = Max(*score, (double) instuples / Max(vacinsthresh, 1));
> + }
 I think it ( *score = *score = Max(*score, (double) instuples / Max(vacinsthresh, 1));) I believe this must be a slip of the hand on your part, having copied an extra one.
I also suggest add debug log for score 
    ereport(DEBUG2,
            (errmsg("autovacuum candidate: %s (score=%.3f)",
                    get_rel_name(table->oid), table->score)));

> + effective_xid_failsafe_age = Max(vacuum_failsafe_age,
> + autovacuum_freeze_max_age * 1.05);
Typically, DBAs avoid setting autovacuum_freeze_max_age too close to vacuum_failsafe_age. Therefore, your logic most likely uses the vacuum_failsafe_age value.
Would taking the average of the two be a better approach?
#
root@localhost:/data/pgsql/pg18data# grep vacuum_failsafe_age postgresql.conf
#vacuum_failsafe_age = 1600000000
root@localhost:/data/pgsql/pg18data# grep autovacuum_freeze_max_age postgresql.conf
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum



Thanks 

On Wed, Oct 29, 2025 at 6:45 AM Sami Imseih <samimseih@gmail.com> wrote:
> Done.

My compiler is complaining about v6

"../src/backend/postmaster/autovacuum.c:3293:32: warning: operation on
‘*score’ may be undefined [-Wsequence-point]
 3293 |                         *score = *score = Max(*score, (double)
instuples / Max(vacinsthresh, 1));
[2/2] Linking target src/backend/postgres"

shouldn't just be like below?

*score =Max(*score, (double) instuples / Max(vacinsthresh, 1));


--
Sami


В списке pgsql-hackers по дате отправления: