Re: time taking deletion on large tables

2020-12-03 Thread Andrew Dunstan
On 12/3/20 11:16 AM, Tom Lane wrote: > Justin Pryzby writes: >> On Thu, Dec 03, 2020 at 08:43:57PM +0530, Ravikumar Reddy wrote: >>> When I try to do a delete like this: it hangs for an entire day, so I >>> need to kill it with pg_terminate_backend(pid). >>> >>> DELETE FROM feed_posts >>> WHERE

Re: time taking deletion on large tables

2020-12-03 Thread Tom Lane
Justin Pryzby writes: > On Thu, Dec 03, 2020 at 08:43:57PM +0530, Ravikumar Reddy wrote: >> When I try to do a delete like this: it hangs for an entire day, so I >> need to kill it with pg_terminate_backend(pid). >> >> DELETE FROM feed_posts >> WHERE feed_definition_id = 'bf33573d-936e-4e55-8607

Re: time taking deletion on large tables

2020-12-03 Thread Justin Pryzby
On Thu, Dec 03, 2020 at 08:43:57PM +0530, Ravikumar Reddy wrote: > Please try the code below. Execute all the statements in one transaction. > > select * into new_table from old_table where type = 'abcz'; > truncate table old_table; > inesrt into old_table select * from new_table; This looks l

Re: time taking deletion on large tables

2020-12-03 Thread Ravikumar Reddy
Hi Atul, Please try the code below. Execute all the statements in one transaction. select * into new_table from old_table where type = 'abcz'; truncate table old_table; inesrt into old_table select * from new_table; On Thu, Dec 3, 2020 at 8:16 PM Atul Kumar wrote: > Hi, > > The feed_post