Thread: Deleting row in 7.4 takes for ever

Deleting row in 7.4 takes for ever

From
"Bharat Patel"
Date:

Hello,

 

I’m new to postgres and the work of DB’s.

I’m running postres 7.4 on RHLinux 3.

I have a table that has 5.4 million rows of data in it.  4.6 million of these rows are just administrative messages and not necessary so I’d like to delete them.  If I try and delete them, it takes 69 minutes to delete ~650K rows.  The current postgres configurations are defaults in postgres.conf file.  I’ve tried bumping up the shared_bufferes in the conf file, but it does not help.  Also I am unable to start postgres is I change the shared_buffers to a values higher then 2000.

 

We have a project underway to upgrade to postgres 8.2, but that will take some time, so I’d like to delete these in 7.4 if at all possible in a reasonable amount of time so that I can minimize production impact to customers.

 

Any and all suggestion will be greatly appreciated.

 

Regards

Bharat

 

Re: Deleting row in 7.4 takes for ever

From
Tom Lane
Date:
"Bharat Patel" <bharatpatelk@gmail.com> writes:
> I have a table that has 5.4 million rows of data in it.  4.6 million of
> these rows are just administrative messages and not necessary so I'd like to
> delete them.  If I try and delete them, it takes 69 minutes to delete ~650K
> rows.

I'm betting on an unindexed foreign-key constraint linking to this
table.

            regards, tom lane