From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Dipesh Kamdar <dipesh.kamdar@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14938: ALTER TABLE hang/ poor performance
Date: Mon, 11 Dec 2017 00:35:42 +0100
Message-ID: <feb76987-68d1-7aac-2660-5cb345c9c525@2ndquadrant.com> (raw)
In-Reply-To: <CACLLSiOa++jEJ5VtggKDdTXdZqazoDE7SAfK-gPPEdZJBp0i+g@mail.gmail.com>
References: <20171130233056.27101.86374@wrigleys.postgresql.org>
<e590b5a0-24cf-3ae0-1264-74172b692d63@2ndquadrant.com>
<CACLLSiN0HZAK5YBHURXKq6-=Um3cmjFcPVnTrzKRyVS-tEwjLQ@mail.gmail.com>
<9e33cd3a-cada-ee2d-5f4f-160be257d6a3@2ndquadrant.com>
<CACLLSiOa++jEJ5VtggKDdTXdZqazoDE7SAfK-gPPEdZJBp0i+g@mail.gmail.com>
On 12/06/2017 12:13 AM, Dipesh Kamdar wrote:
> Here is few day back log msg. Removing actual table name and SQL but
> keeping actual msg.
>
> log file msg:
>
> 2017-11-30 13:24:34.513 GMT]: LOG: *duration: 49082304.526 ms* execute
> <unnamed>: ALTER TABLE *tablename1 *SET (autovacuum_enabled= FALSE ,
> toast.autovacuum_enabled=FALSE )
> [2017-11-30 13:24:35.517 GMT]: LOG: *duration: 30496621.974 *ms parse
> <unnamed>: SELECT column list FROM tablename2 INNER JOIN *tablename1*
> ON condation1.
> [2017-11-30 13:37:10.106 GMT]: LOG: duration: *31239025.847* ms
> execute <unnamed>: ANALYZE
>
Obviously, you have other long-running queries (e.g. the join query),
not just the ALTER TABLE.
>
> We have following setting enable in postgres config file.
> *log_min_duration_statement = 300000 # 5min *
> *deadlock_timeout = 1s # default*
> *
Perhaps try also "log_lock_waits = on".
> *
> database monitoring script is not reporting any process is waiting for
> lock. In this case deadlock is not occurring but it hangs almost 12
> hours. I am seeing this pattern once a day in log file with other table
> during same batch job run. Not any other SQL reported in log that say
> took more than 5 min.
>
> Why don't we see deadlock? Why don't we see any lock waiting in pg_locks
> table ?
>
Well, that's really hard to say without you showing us the pg_locks
contents (instead of just telling us there's nothing suspicious in it).
Also, pg_stat_activity collected at the same time would be useful.
Other than that, you can attach gdb to the waiting process, and see
where exactly it's waiting (collect backtrace using "bt").
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: tomas.vondra@2ndquadrant.com, dipesh.kamdar@gmail.com
Subject: Re: BUG #14938: ALTER TABLE hang/ poor performance
In-Reply-To: <feb76987-68d1-7aac-2660-5cb345c9c525@2ndquadrant.com>
References: <20171130233056.27101.86374@wrigleys.postgresql.org> <e590b5a0-24cf-3ae0-1264-74172b692d63@2ndquadrant.com> <CACLLSiN0HZAK5YBHURXKq6-=Um3cmjFcPVnTrzKRyVS-tEwjLQ@mail.gmail.com> <9e33cd3a-cada-ee2d-5f4f-160be257d6a3@2ndquadrant.com> <CACLLSiOa++jEJ5VtggKDdTXdZqazoDE7SAfK-gPPEdZJBp0i+g@mail.gmail.com> <feb76987-68d1-7aac-2660-5cb345c9c525@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