pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Holger Jakobs <holger@jakobs.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Issue with delete
Date: Thu, 24 Jun 2021 11:22:47 +0200
Message-ID: <ac5513c0-1b0e-ba7e-81fd-27c41d9d5ea1@jakobs.com> (raw)
In-Reply-To: <266147493.2758919.1624525689006@mail.yahoo.com>
References: <266147493.2758919.1624525689006.ref@mail.yahoo.com>
	<266147493.2758919.1624525689006@mail.yahoo.com>

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

Attachments:

  OpenPGP_signature (application/pgp-signature, 202B) download

view thread (7+ messages)  latest in thread

Message-ID: <ac5513c0-1b0e-ba7e-81fd-27c41d9d5ea1@jakobs.com>
Permalink:  ../ac5513c0-1b0e-ba7e-81fd-27c41d9d5ea1@jakobs.com/
Also on:    postgresql.org/message-id/ac5513c0-1b0e-ba7e-81fd-27c41d9d5ea1@jakobs.com

 · 

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: holger@jakobs.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Issue with delete
  In-Reply-To: <ac5513c0-1b0e-ba7e-81fd-27c41d9d5ea1@jakobs.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