Re: Deleting millions of rows

From: Brian Cox <brian(dot)cox(at)ca(dot)com>
To: "Robert Haas [robertmhaas(at)gmail(dot)com]" <robertmhaas(at)gmail(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:01:53
Message-ID: 49875131.8060502@ca.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Robert Haas [robertmhaas(at)gmail(dot)com] wrote:
Thanks for your response.

> Does the table have triggers on it? Does it have indexes? What is the
> result of pg_relation_size() on that table?
No triggers; 3 indexes
cemdb=> select pg_relation_size('ts_defects');
pg_relation_size
------------------
9464971264
(1 row)

cemdb=>
cemdb=> select pg_relation_size('ts_defects_DateIndex');
pg_relation_size
------------------
1299931136
(1 row)

cemdb=> select pg_relation_size('ts_defects_DefectIndex');
pg_relation_size
------------------
1217224704
(1 row)

cemdb=> select pg_relation_size('ts_defects_EventIndex');
pg_relation_size
------------------
1216528384

>
> How much memory do you have in your machine? What is work_mem set to?
32G; work_mem=64M

> 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?

Thanks,
Brian

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2009-02-02 20:07:59 Re: Deleting millions of rows
Previous Message Dave Dutcher 2009-02-02 19:35:22 Re: Deleting millions of rows