Re: Fast way to delete big table? - Mailing list pgsql-general
From | Jeff Janes |
---|---|
Subject | Re: Fast way to delete big table? |
Date | |
Msg-id | CAMkU=1x48Kx=ztB021GNAodRR9_ZwfMGNhGJC6RW_b-z_ihKnQ@mail.gmail.com Whole thread Raw |
In response to | Fast way to delete big table? (Haiming Zhang <Haiming.Zhang@redflex.com.au>) |
Responses |
Re: Fast way to delete big table?
|
List | pgsql-general |
Hi All,
I have a big table (200G with 728 million records), the table slows down lots of things. It's time to clean the data up. The requirement is when I delete I must summarise few columns to a new table for backup purpose. So that mean I need to go through each row and add the columns' value to the summary table (the corresponding category).
The table has indexes (multicoumn indexes) before, I removed the indexes because I read on forum says the indexes heavily reduce the speed of deleting.
That's true if I only delete from the table, but my case is I first SELECT this row, then add few values to the summary table and then DELETE the row according to its multiple primary key. This seems to be a bad idea now as it takes very long time to DELETE the row (as delete needs to find the row first).
...
Method 2 is bit faster but not much, the delete speed is 2478 rows/s for method 2 and 2008 rows/s for method 1.
Any suggestions are welcomed.
pgsql-general by date: