Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E3E14F497BB for ; Mon, 27 Feb 2012 10:46:16 -0400 (AST) Received: from smtp2.peak6.com ([38.98.137.9]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S21q4-0006t7-Mu for pgsql-performance@postgresql.org; Mon, 27 Feb 2012 14:46:14 +0000 X-AuditID: 0a02cb1e-b7bceae0000009d3-0a-4f4b9727ffae Message-ID: <4F4B9721.6050808@peak6.com> Date: Mon, 27 Feb 2012 08:45:53 -0600 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: "Reuven M. Lerner" CC: Subject: Re: Very long deletion time on a 200 GB database References: <4F45FB55.1020600@lerner.co.il> <4F47C6C4.6030102@pinpointresearch.com> <4F4B39EF.2080004@lerner.co.il> In-Reply-To: <4F4B39EF.2080004@lerner.co.il> Content-Type: text/plain; charset="UTF-8"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.107.46] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLIsWRmVeSWpSXmKPExsXCxcQroas+3dvf4P5uG4vrM88xW7x/tJvJ gclj6rMHLB4X9k1jD2CKamC0SczLyy9JLElVSEktTrZVCnB19DZTcMksTs5JzMxNLVJSyEyx VTJTUijISUxOzU3NK7FVSiwoSM1LUbLjUsAANkBlmXkKqXnJ+SmZeem2Sp7B/roWFqaWuoZK dvFYQEITS8bu64EFyzkrtj1czN7AuJ69i5GTQ0LAROL61RuMELaYxIV769lAbF4BDYkzd/uY QWwWAVWJ6T9nMYHYbAJqEgt33wSrFxKQldi/6hwriM0vICyx70MTUD0Hh6hAmMSCd54QYwQl Ts58wgJiiwjoSOzufgE2hhlozNyHk8BahQWcJU49PscOMbJY4ta912BrOYHqrz/dywxRbyGx +M1BdghbXmL72znMEPVyEncanrNBnK8gMedqO8sERqFZSFbPQtI+C0n7AkbmVYzixWWJyRmZ ZgXFuSUFhnoFqYnZZnp5qSWbGMFRe1puB+OKC4qHGAU4GJV4eBc89vIXYk0sK67MPcQowcGs JMKrn+3tL8SbklhZlVqUH19UmpNafIjRFBhkE5mlRJPzgQklryTe0NjQ0tTS2MzAyMTSQkmc t5XH1l9IIB2YGLJTUwtSi2D6mDg4pRoYpZ994iuW7BLWKF+zOURb4sU1pUmx1k9SGOOeKUy+ NX1qqaCSrFz/gVM9IWZZPndNU6Q/WFR9y7OabN2YmrbJ583i0L2Nhjk5Yt1x7kr34563GopG B2w6tijbYqL+meLk3sdxYad538aGnQp3i3ivdTyhp8Hrxm3DLT+bJv/2zLiTarErQVuJpTgj 0VCLuag4EQDuFuYt8AIAAA== X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/227 X-Sequence-Number: 46399 On 02/27/2012 02:08 AM, Reuven M. Lerner wrote: > In the end, it was agreed that we could execute the deletes over > time, deleting items in the background, or in parallel with the > application's work. After all, if the disk is filling up at the rate > of 2 GB/day, then so long as we delete 4 GB/day (which is pretty easy > to do), we should be fine. Please tell me you understand deleting rows from a PostgreSQL database doesn't work like this. :) The MVCC storage system means you'll basically just be marking all those deleted rows as reusable, so your database will stop growing, but you'll eventually want to purge all the accumulated dead rows. One way to see how many there are is to use the pgstattuple contrib module. You can just call it on the table name in question: SELECT * FROM pgstattuple('my_table'); You may find that after your deletes are done, you'll have a free_pct of 80+%. In order to get rid of all that, you'll need to either run CLUSTER on your table(s) or use the select->truncate->insert method anyway. -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-444-8534 sthomas@peak6.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email