*** a/doc/src/sgml/config.sgml --- b/doc/src/sgml/config.sgml *************** *** 4955,4961 **** COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; This parameter can only be set in the postgresql.conf file or on the server command line. This setting can be overridden for individual tables by ! changing storage parameters. --- 4955,4962 ---- This parameter can only be set in the postgresql.conf file or on the server command line. This setting can be overridden for individual tables by ! changing storage parameters. The user specified value is ignored if it ! is the same limit as value. *** a/src/backend/postmaster/autovacuum.c --- b/src/backend/postmaster/autovacuum.c *************** *** 1776,1795 **** autovac_balance_cost(void) if (vac_cost_limit <= 0 || vac_cost_delay <= 0) return; ! /* caculate the total base cost limit of active workers */ cost_total = 0.0; dlist_foreach(iter, &AutoVacuumShmem->av_runningWorkers) { WorkerInfo worker = dlist_container(WorkerInfoData, wi_links, iter.cur); if (worker->wi_proc != NULL && ! worker->wi_cost_limit_base > 0 && worker->wi_cost_delay > 0) cost_total += (double) worker->wi_cost_limit_base / worker->wi_cost_delay; } - /* there are no cost limits -- nothing to do */ - if (cost_total <= 0) - return; /* * Adjust cost limit of each active worker to balance the total of cost --- 1776,1794 ---- if (vac_cost_limit <= 0 || vac_cost_delay <= 0) return; ! /* calculate the total base cost limit of active workers */ cost_total = 0.0; dlist_foreach(iter, &AutoVacuumShmem->av_runningWorkers) { WorkerInfo worker = dlist_container(WorkerInfoData, wi_links, iter.cur); if (worker->wi_proc != NULL && ! worker->wi_cost_limit_base > 0 && ! worker->wi_cost_delay > 0 && ! worker->wi_cost_limit_base == vac_cost_limit) cost_total += (double) worker->wi_cost_limit_base / worker->wi_cost_delay; } /* * Adjust cost limit of each active worker to balance the total of cost *************** *** 1803,1820 **** autovac_balance_cost(void) if (worker->wi_proc != NULL && worker->wi_cost_limit_base > 0 && worker->wi_cost_delay > 0) { ! int limit = (int) ! (cost_avail * worker->wi_cost_limit_base / cost_total); ! /* ! * We put a lower bound of 1 on the cost_limit, to avoid division- ! * by-zero in the vacuum code. Also, in case of roundoff trouble ! * in these calculations, let's be sure we don't ever set ! * cost_limit to more than the base value. ! */ ! worker->wi_cost_limit = Max(Min(limit, ! worker->wi_cost_limit_base), ! 1); elog(DEBUG2, "autovac_balance_cost(pid=%u db=%u, rel=%u, cost_limit=%d, cost_limit_base=%d, cost_delay=%d)", worker->wi_proc->pid, worker->wi_dboid, worker->wi_tableoid, --- 1802,1823 ---- if (worker->wi_proc != NULL && worker->wi_cost_limit_base > 0 && worker->wi_cost_delay > 0) { ! if (worker->wi_cost_limit_base == vac_cost_limit && ! cost_total > 0) ! { ! int limit = (int) ! (cost_avail * worker->wi_cost_limit_base / cost_total); ! /* ! * We put a lower bound of 1 on the cost_limit, to avoid ! * division- by-zero in the vacuum code. Also, in case of ! * roundoff trouble in these calculations, let's be sure we ! * don't ever set cost_limit to more than the base value. ! */ ! worker->wi_cost_limit = Max(Min(limit, ! worker->wi_cost_limit_base), ! 1); ! } elog(DEBUG2, "autovac_balance_cost(pid=%u db=%u, rel=%u, cost_limit=%d, cost_limit_base=%d, cost_delay=%d)", worker->wi_proc->pid, worker->wi_dboid, worker->wi_tableoid,