pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Raghavendra Rao J S V <raghavendrajsv@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: is there any adverse effect on DB if I set autovacuum scale factor to zero?
Date: Mon, 13 Aug 2018 15:59:09 +0200
Message-ID: <5e337338-eadc-1bac-3775-ba7489963415@2ndquadrant.com> (raw)
In-Reply-To: <CAEHH7R4+9nq4sBRhDZcmdj-qjOabizNv=W8UfAqsXmX2+h51sQ@mail.gmail.com>
References: <CAEHH7R66M1tqPMveLwq1njcE0A2zvBVUjnUARXCMhF-rQBfuKQ@mail.gmail.com>
	<64b01682-49bd-8577-45de-0114fd6af372@2ndquadrant.com>
	<CAEHH7R4+9nq4sBRhDZcmdj-qjOabizNv=W8UfAqsXmX2+h51sQ@mail.gmail.com>



On 08/13/2018 03:41 PM, Raghavendra Rao J S V wrote:
> 
> Hi Tomas,
> 
> Thank you very much for your response.
> 
> As we  know table becomes a candidate for autovacuum  process based on 
> below formula.
> 
> 
> *Autovacuum VACUUM thresold for a table = autovacuum_vacuum_scale_factor 
> * number of tuples + autovacuum_vacuum_threshold*
> 
> 
> 
> *Current settings in my database are as follows.*
> 
> 
> /autovacuum_vacuum_scale_factor = 0.1/
> 
> /autovacuum_vacuum_threshold = 40/
> 
> 
> 
> Due to above formula the dead tuples are accumulating based on the 
> number of live tuples as show below picture.
> 
> 
> 
> select relname,n_live_tup,n_dead_tup,(n_live_tup*.1+40) 
> expected_to_autovacuum,* from pg_stat_user_tables
> where  n_dead_tup>800
> order by n_live_tup desc
> limit 100;
> 
> 
> 
> 
> In order to avoid the dead tuples accumulation I wold like to change the 
> auto vacuum  settings in *"postgresql.conf"* as below.
> 
> /autovacuum_vacuum_scale_factor = 0.01/
> //autovacuum_vacuum_threshold = 100/
> /

OK, so the tables apparently have enough dead tuples to trigger vacuum. 
That mean the autovacuum throughput is insufficient to do all the 
cleanup. If you lower the scale factor, the amount of cleanup will 
*increase* (more tables being eligible for cleanup) making it less 
likely autovacuum can keep up.

You need to increase the throughtput, by increasing vacuum_cost_limit or 
something like that.

> *Kindly guide me your views. Does it cause any adverse effect on DB.*
> *

Well, it forces the database to do more stuff / more often, so it may 
have adverse impact, of course. It's hard to say if it's going to be a 
win overall, because we don't know how serious is the bloat.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (6+ messages)  latest in thread

Message-ID: <5e337338-eadc-1bac-3775-ba7489963415@2ndquadrant.com>
Permalink:  ../5e337338-eadc-1bac-3775-ba7489963415@2ndquadrant.com/
Also on:    postgresql.org/message-id/5e337338-eadc-1bac-3775-ba7489963415@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, raghavendrajsv@gmail.com
  Subject: Re: is there any adverse effect on DB if I set autovacuum scale factor to zero?
  In-Reply-To: <5e337338-eadc-1bac-3775-ba7489963415@2ndquadrant.com>
  References: <CAEHH7R66M1tqPMveLwq1njcE0A2zvBVUjnUARXCMhF-rQBfuKQ@mail.gmail.com> <64b01682-49bd-8577-45de-0114fd6af372@2ndquadrant.com> <CAEHH7R4+9nq4sBRhDZcmdj-qjOabizNv=W8UfAqsXmX2+h51sQ@mail.gmail.com> <5e337338-eadc-1bac-3775-ba7489963415@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox