pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Devendra Yadav <devendra.857@gmail.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: ALTER TABLE ADD COLUMN takes forever
Date: Tue, 30 Mar 2021 13:12:16 +0200
Message-ID: <295d4316f690b7666dcd21b745a4163b88a5ee4b.camel@cybertec.at> (raw)
In-Reply-To: <CAE+tJY_Xyf+k=oxy=KYo6bjnbeS0sFA4SxmYrYs=6h6toV1ebA@mail.gmail.com>
References: <CAE+tJY8xRe_PoYbBveOMRnm17wbtjCMMS8rdJfCdKjztymHbYQ@mail.gmail.com>
	<b987bc47cd88cfe24cc01cddaecdb4bca57a0bfb.camel@cybertec.at>
	<CAE+tJY_Xyf+k=oxy=KYo6bjnbeS0sFA4SxmYrYs=6h6toV1ebA@mail.gmail.com>

On Mon, 2021-03-29 at 22:48 +0530, Devendra Yadav wrote:
> > I am running a query on a table - ALTER TABLE mytable ADD COLUMN deposited DOUBLE PRECISION DEFAULT 0.0;
> > > 
> > > this query just runs forever.
> > 
> > Then either you are using a PostgreSQL version older than v11, or there
> > is an open transaction that used the table and blocks you.
>
> We are using PostgreSQL v12.1
> There are no open transactions as the table is not blocked by any pid. However when i check pg_locks it say granted=false
> but nothing blocking it. Bit strange!!

As I replied in the other thread you started, you are probably blocked
by a prepared transaction.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (7+ messages)  latest in thread

Message-ID: <295d4316f690b7666dcd21b745a4163b88a5ee4b.camel@cybertec.at>
Permalink:  ../295d4316f690b7666dcd21b745a4163b88a5ee4b.camel@cybertec.at/
Also on:    postgresql.org/message-id/295d4316f690b7666dcd21b745a4163b88a5ee4b.camel@cybertec.at

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, devendra.857@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: ALTER TABLE ADD COLUMN takes forever
  In-Reply-To: <295d4316f690b7666dcd21b745a4163b88a5ee4b.camel@cybertec.at>

* 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