Re: BUG #14938: ALTER TABLE hang/ poor performance

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: dipesh(dot)kamdar(at)gmail(dot)com
Cc: Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14938: ALTER TABLE hang/ poor performance
Date: 2017-12-10 23:12:43
Message-ID: CAMkU=1yjAdYyCzPFpWN6m6ZU8HrNOLW_T+b6N6ExjgCBu7WQ-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 30, 2017 at 3:30 PM, <dipesh(dot)kamdar(at)gmail(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14938
> Logged by: Dipesh Kamdar
> Email address: dipesh(dot)kamdar(at)gmail(dot)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.
>

This is hard to believe. Are these detected deadlocks (which are resolved
by one process getting served an ERROR) or are they undetected deadlocks,
which simply freeze the system until someone manually kills something? If
they are detected deadlocks, please share the part of the server log file
which describes the 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);
>

It seems to me that your "solution" to the problem is what is causing the
problem.

Cheers,

Jeff

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2017-12-10 23:14:54 Re: BUG #14932: SELECT DISTINCT val FROM table gets stuck in an infinite loop
Previous Message Devrim Gündüz 2017-12-10 22:13:37 Re: BUG #14957: service initdb fails (initdbcmd run in background)