pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hubert depesz Lubaczewski <depesz@depesz.pl>
To: Raymond Chui <raymond.chui@noaa.gov>
To: pgsql-admin@postgresql.org
Subject: Re: Fast Deletion For Large Tables
Date: Sat, 5 Oct 2002 10:21:36 +0200
Message-ID: <20021005082136.GA23998@depesz.pl> (raw)
In-Reply-To: <3D9B38F7.12A7AEA3@noaa.gov>
References: <3D9B38F7.12A7AEA3@noaa.gov>

On Wed, Oct 02, 2002 at 02:20:39PM -0400, Raymond Chui wrote:
> Everything is running fine, except take long time to finish.
> Because some tables stored values from 50,000 to 100,000 rows
> Some deletion need to deleted up to 45,000 rows.

how often do you make this "delete" process?
do you vacuum before *and* after it?
with deleteing 45000 out of 50000 (or 100000) records no index can speed
up. anyway - deleting 45000 records shouldn't take very long.
do you have any foreign keys from this table to others? any indices?

try maybe this path:
connect
vacuum
drop indices
disconnect
connect
delete from ...
create indices
vacuum analyze
disconnect

could work better.

depesz

-- 
hubert depesz lubaczewski                          http://www.depesz.pl/
------------------------------------------------------------------------
Mój Boże, spraw abym milczał, dopóki się nie upewnię,  że  naprawdę  mam
coś do powiedzenia.                                      (c) 1998 depesz

view thread (9+ messages)  latest in thread

Message-ID: <20021005082136.GA23998@depesz.pl>
Permalink:  ../20021005082136.GA23998@depesz.pl/
Also on:    postgresql.org/message-id/20021005082136.GA23998@depesz.pl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: depesz@depesz.pl, raymond.chui@noaa.gov
  Subject: Re: Fast Deletion For Large Tables
  In-Reply-To: <20021005082136.GA23998@depesz.pl>
  References: <3D9B38F7.12A7AEA3@noaa.gov> <20021005082136.GA23998@depesz.pl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox