pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DELETE Query Hang
4+ messages / 2 participants
[nested] [flat]

* DELETE Query Hang
@ 2019-11-12 22:47 DrakoRod <drakoflames@hotmail.com>
  2019-11-12 22:51 ` Re: DELETE Query Hang Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: DrakoRod @ 2019-11-12 22:47 UTC (permalink / raw)
  To: pgsql-general

Hi folks! 

I Have a question, in a database are a table with many files (bytea) stored
(I support this database a don't design it), but we need delete many rows
(38000 rows approx),  but I when execute query: 

BEGIN;
ALTER TABLE my_file_table DISABLE TRIGGER ALL;
DELETE FROM my_file_table WHERE id_table <> 230;

This query hang... 50 minutes and the query do not finish. 

Any suggestion? 



-----
Dame un poco de fe, eso me bastará.
Rozvo Ware Solutions 
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DELETE Query Hang
  2019-11-12 22:47 DELETE Query Hang DrakoRod <drakoflames@hotmail.com>
@ 2019-11-12 22:51 ` Rob Sargent <robjsargent@gmail.com>
  2019-11-12 23:01   ` Re: DELETE Query Hang DrakoRod <drakoflames@hotmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Rob Sargent @ 2019-11-12 22:51 UTC (permalink / raw)
  To: DrakoRod <drakoflames@hotmail.com>; +Cc: pgsql-general



> On Nov 12, 2019, at 3:47 PM, DrakoRod <drakoflames@hotmail.com> wrote:
> 
> Hi folks! 
> 
> I Have a question, in a database are a table with many files (bytea) stored
> (I support this database a don't design it), but we need delete many rows
> (38000 rows approx),  but I when execute query: 
> 
> BEGIN;
> ALTER TABLE my_file_table DISABLE TRIGGER ALL;
> DELETE FROM my_file_table WHERE id_table <> 230;
> 
> This query hang... 50 minutes and the query do not finish. 
> 
> Any suggestion? 
> 
> 


You don’t mention which version you’re using be I had this trouble long ago on version 9 when deleting blobs (toast data).  You can only wait.  Or kill it and do smaller batches.







^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DELETE Query Hang
  2019-11-12 22:47 DELETE Query Hang DrakoRod <drakoflames@hotmail.com>
  2019-11-12 22:51 ` Re: DELETE Query Hang Rob Sargent <robjsargent@gmail.com>
@ 2019-11-12 23:01   ` DrakoRod <drakoflames@hotmail.com>
  2019-11-12 23:04     ` Re: DELETE Query Hang Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: DrakoRod @ 2019-11-12 23:01 UTC (permalink / raw)
  To: pgsql-general

I understand, yep is a 9.5 version, Can I use query like this to execute
smaller batches?:

DELETE FROM my_table
WHERE id IN (
    SELECT id
    FROM logtable
    LIMIT 10
);

Thanks




-----
Dame un poco de fe, eso me bastará.
Rozvo Ware Solutions 
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DELETE Query Hang
  2019-11-12 22:47 DELETE Query Hang DrakoRod <drakoflames@hotmail.com>
  2019-11-12 22:51 ` Re: DELETE Query Hang Rob Sargent <robjsargent@gmail.com>
  2019-11-12 23:01   ` Re: DELETE Query Hang DrakoRod <drakoflames@hotmail.com>
@ 2019-11-12 23:04     ` Rob Sargent <robjsargent@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Rob Sargent @ 2019-11-12 23:04 UTC (permalink / raw)
  To: DrakoRod <drakoflames@hotmail.com>; +Cc: pgsql-general



> On Nov 12, 2019, at 4:01 PM, DrakoRod <drakoflames@hotmail.com> wrote:
> 
> I understand, yep is a 9.5 version, Can I use query like this to execute
> smaller batches?:
> 
> DELETE FROM my_table
> WHERE id IN (
>    SELECT id
>    FROM logtable
>    LIMIT 10
> );
> 
> Thanks
> 

I think you still want to qualify as you had previously.. id <> 230 or something.

I’m not saying this is faster, in total, but you will get through!

> 
> 
> 
> -----
> Dame un poco de fe, eso me bastará.
> Rozvo Ware Solutions 
> --
> Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
> 
> 






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-11-12 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 22:47 DELETE Query Hang DrakoRod <drakoflames@hotmail.com>
2019-11-12 22:51 ` Rob Sargent <robjsargent@gmail.com>
2019-11-12 23:01   ` DrakoRod <drakoflames@hotmail.com>
2019-11-12 23:04     ` Rob Sargent <robjsargent@gmail.com>

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