Re: Issue with delete

From: Holger Jakobs <holger(at)jakobs(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Issue with delete
Date: 2021-06-24 09:22:47
Message-ID: ac5513c0-1b0e-ba7e-81fd-27c41d9d5ea1@jakobs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Am 24.06.21 um 11:08 schrieb Rohit Rajput:
> Good day everyone,
>
> I have few tables where i need to delete above 50 million rows each.
> Since i dont want to delete them all in one shot and block my table
> for extended time, i am trying to use limit with delete but its giving
> me error every time. May i please get some assistance here? Thanks
>
> Here is what i am running:
>
> delete from mytable where id in (select id from mytable where
> condition=true limit 1000);
>
> where i run this, i get following error:
>
>     Error: current transaction is aborted, commands ignored until end
> of transaction block.
> SQL state: 25P02.
>
>
> I am running it in RDS.
>
>
> TIA, Best,
> Rohit

This message stems from a previous error within the same transaction.
Unlike Oracle, PostgreSQL cannot execute commands within a transaction
after an error has occurred.

Make sure that this statement is the first in your transaction or use it
in autocommit mode.

--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Rohit Rajput 2021-06-24 09:34:10 Re: Issue with delete
Previous Message Rohit Rajput 2021-06-24 09:08:09 Issue with delete