pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dipesh.kamdar@gmail.com
To: pgsql-bugs@postgresql.org
Cc: dipesh.kamdar@gmail.com
Subject: BUG #14938: ALTER TABLE hang/  poor performance
Date: Thu, 30 Nov 2017 23:30:56 +0000
Message-ID: <20171130233056.27101.86374@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      14938
Logged by:          Dipesh Kamdar
Email address:      dipesh.kamdar@gmail.com
PostgreSQL version: 9.5.3
Operating system:   Linux
Description:        

Postgres : 9.5.3
Kernal : 3.10.0-327.13.1.el7.x86_64
Linux :  x86_64 x86_64 x86_64 GNU/Linux
RAM 128GB
DISK : 1.5TB


We have nightly job that removed millions of records from multiple table. 

We had following approach.
1.	Delete data from table in batch of 50000

Problem with above approach many time autovacuum on table and delete
statement on table create deadlock. 
In order to avoid above problem, we have taken following approach.

1	Turn off autovacuum on table by using ALTER TABLE <tablename>  SET (
autovacuum_enabled=false);
2.	Delete data from table in batch of 50000 
3.	Turn On autovacuum on table by using ALTER TABLE <tablename>  SET (
autovacuum_enabled=true);


Problem with second approach ALTER TABLE tablename SET (
autovacuum_enabled=FALSE) get hang very often. I am not seeing anything
pg_lock that is waiting for resource and any other process blocking. Process
manytime take 12hour , 13hours etc.
Found article on net regarding vacuum stuck 

http://rhaas.blogspot.com/2011/03/troubleshooting-stuck-vacuums.html

Database monitoring script is not reporting any waiting, pg_log is not
reporting any error or deadlock.
Is there anyway we can figure out any process is blocking or waiting for
resource etc.
My basic understanding about this ALTER TABLE SET command it updated record
in pg_classs.reloptions column. 
Does ALTER TABLE  SET option block complete table? 

Thanks!
Dipesh 





view thread (7+ messages)  latest in thread

Message-ID: <20171130233056.27101.86374@wrigleys.postgresql.org>
Permalink:  ../20171130233056.27101.86374@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20171130233056.27101.86374@wrigleys.postgresql.org

 · 

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-bugs@postgresql.org
  Cc: dipesh.kamdar@gmail.com
  Subject: Re: BUG #14938: ALTER TABLE hang/  poor performance
  In-Reply-To: <20171130233056.27101.86374@wrigleys.postgresql.org>
  References: <20171130233056.27101.86374@wrigleys.postgresql.org>

* 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