Re: ALTER TABLE blocked

From: Devendra Yadav <devendra(dot)857(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: ALTER TABLE blocked
Date: 2021-03-30 11:26:30
Message-ID: CAE+tJY_c7UxmHFvj95BEA=sZH+aJVYi6s08JV+dU_pvQxXh8xQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks a ton Laurenz.

It worked

Regards,
Devendra Yadav

On Tue, 30 Mar 2021, 16:39 Laurenz Albe, <laurenz(dot)albe(at)cybertec(dot)at> wrote:

> On Tue, 2021-03-30 at 12:36 +0530, Devendra Yadav wrote:
> > Hope everything is well with you.
>
> Thanks, yes. I hope you are fine too.
>
> > We are running on PostgreSQL v 12.1 , Redhat 7.8.
> > We are running a query - ALTER TABLE mytable ADD COLUMN deposited
> DOUBLE PRECISION;
> >
> > This query is blocked by pid 0. It's not a postgres PID and won't allow
> to terminate from postgres.
> > What would be the way forward to troubleshoot this?
>
> That is probably a stale prepared transaction.
>
> Look into "pg_prepared_xacts" for any prepared transactions and use
>
> ROLLBACK PREPARED 'name';
>
> to remove stale entries.
>
> When using prepared transactions, you must use a transaction manager
> that does these things for you. Also, you should monitor prepared
> transactions.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Devendra Yadav 2021-03-30 11:47:11 Re: ALTER TABLE ADD COLUMN takes forever
Previous Message Laurenz Albe 2021-03-30 11:12:16 Re: ALTER TABLE ADD COLUMN takes forever