I need to delete about 2 million rows from my PG database. I have a list of identifiers that I need to delete. However, any way I try to do this is to take several days.
I tried to put them in a table and do it in batches of 100. After 4 days, this is still done, deleting only 297268 rows. (I needed to select 100 identifiers from the identifier table, delete where IN is in this list, remove the 100 that I selected from the identifier table).
I tried:
DELETE FROM tbl WHERE id IN (select * from ids)
It is also forever. It is difficult to determine how much time, since I do not see its progress to completion, but the request still works after 2 days.
Just find the most efficient way to remove from the table when I know which identifier is deleted and there are millions of identifiers.
sql sql-delete postgresql postgresql-performance bigdata
Anthony Greco Nov 28 '11 at 2:29 2011-11-28 02:29
source share