Re: Deleting millions of rows

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Brian Cox <brian(dot)cox(at)ca(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Deleting millions of rows
Date: 2009-02-02 20:07:59
Message-ID: 603c8f070902021207y636a0139r9fdd6ffc2a252e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Feb 2, 2009 at 3:01 PM, Brian Cox <brian(dot)cox(at)ca(dot)com> wrote:
>> How much memory do you have in your machine? What is work_mem set to?
>
> 32G; work_mem=64M

Hmm. Well then I'm not sure why you're running out of memory, that
seems like a bug. Taking a long time, I understand. Crashing, not so
much.

>> Did you try VACUUM FULL instead of just plain VACUUM to recover
>> performance? You might also need to REINDEX.
>> Or you could TRUNCATE the table.
>
> I didn't try FULL or REINDEX. In this case, TRUNCATE is the best option as I
> was just trying to reset the state of the table for another test. But this
> brings up another question: will autovacuum do the right thing to preserve
> performance on this table when many rows are deleted?

I don't think so. I think you need to VACUUM FULL and REINDEX when
you do a big DELETE. But if you TRUNCATE then you should be OK - no
further cleanup required in that case.

...Robert

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Wilson 2009-02-02 20:20:14 Re: Deleting millions of rows
Previous Message Brian Cox 2009-02-02 20:01:53 Re: Deleting millions of rows