From: | Alexander Stanier <alexander(dot)stanier(at)egsgroup(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How to increase row deletion efficiency? |
Date: | 2005-12-22 17:13:51 |
Message-ID: | 43AADECF.8070702@egsgroup.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Have only just had a chance to try this. There were several missing
indexes on the referencing columns including one on a table of circa
150K records. It now completes in a couple of minutes. Also it appears
to be quicker if one doesn't defer the constraints. Thanks for the
advice.<br>
<br>
Regards, Alex.<br>
<br>
Tom Lane wrote:
<blockquote cite="mid29270(dot)1133968316(at)sss(dot)pgh(dot)pa(dot)us" type="cite">
<pre wrap="">Alexander Stanier <a class="moz-txt-link-rfc2396E" href="mailto:alexander(dot)stanier(at)egsgroup(dot)com"><alexander(dot)stanier(at)egsgroup(dot)com></a> writes:
</pre>
<blockquote type="cite">
<pre wrap="">I am currently trying to separate two environments contained in one
database. Essentially I need to break that one database down into two
with a portion of the data going to each new database. I am intending to
achieve this by duplicating the database and then stripping out the data
that is not required in each database. I have started by trying to
delete data from a set of 28 related tables, however the performance
appears to be terrible. I am deleting from a table called document which
cascades down to 27 tables underneath it linked by various cascading
foreign key constraints. Some of these subsidiary tables have as many as
a couple of million records.
</pre>
</blockquote>
<pre wrap=""><!---->
Do you have indexes on the referencing columns? PG enforces an index on
the referenced column, but not on the other end, and DELETE is where it
will hurt if you haven't got one.
regards, tom lane
</pre>
</blockquote>
</body>
</html>
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/html | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2005-12-22 18:59:38 | Re: Does VACUUM reorder tables on clustered indices |
Previous Message | Bruce Momjian | 2005-12-22 16:01:17 | Re: Querying date_time for date only ? |