Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id A71781EB83E6 for ; Thu, 23 Feb 2012 07:23:08 -0400 (AST) Received: from archon2012.plus.com ([80.229.41.160] helo=mail.archonet.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S0WlM-00043j-K9 for pgsql-performance@postgresql.org; Thu, 23 Feb 2012 11:23:07 +0000 Received: from [192.168.1.13] (ariel.office.archonet.com [192.168.1.13]) by mail.archonet.com (Postfix) with ESMTP id F09CA7C04D; Thu, 23 Feb 2012 11:22:49 +0000 (GMT) Message-ID: <4F46219D.2000404@archonet.com> Date: Thu, 23 Feb 2012 11:23:09 +0000 From: Richard Huxton User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Iceowl/1.0b2 Icedove/3.1.16 MIME-Version: 1.0 To: "Reuven M. Lerner" CC: pgsql-performance@postgresql.org Subject: Re: Very long deletion time on a 200 GB database References: <4F45FB55.1020600@lerner.co.il> In-Reply-To: <4F45FB55.1020600@lerner.co.il> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/155 X-Sequence-Number: 46327 On 23/02/12 08:39, Reuven M. Lerner wrote: > (4) I tried "chunking" the deletes, such that instead of trying to > delete all of the records from the B table, I would instead delete > just those associated with 100 or 200 rows from the R table. On a 1 > GB subset of the data, this seemed to work just fine. But on the > actual database, it was still far too slow. This is the approach I'd take. You don't have enough control / access to come up with a better solution. Build a temp table with 100 ids to delete. Time that, and then next night you can increase to 200 etc until it takes around 3 hours. Oh - and get the Windows admins to take a look at disk activity - the standard performance monitor can tell you more than enough. If it is swapping constantly, performance will be atrocious but even if the disks are just constantly busy then updates and deletes can be very slow. -- Richard Huxton Archonet Ltd