X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0EC5811F8B7B for ; Mon, 10 Apr 2006 03:59:02 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 required=5 tests=[none] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id V2evnPKkthP8 for ; Mon, 10 Apr 2006 03:58:45 -0300 (ADT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4EE4111F7A49 for ; Mon, 10 Apr 2006 03:55:08 -0300 (ADT) Received: from ki-communication.com (unknown [202.147.194.21]) by svr4.postgresql.org (Postfix) with ESMTP id 66B605AF83C for ; Mon, 10 Apr 2006 06:55:05 +0000 (GMT) Received: from edp01wks ([192.168.0.127]) by ki-communication.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Apr 2006 13:54:56 +0700 From: "Ahmad Fajar" To: "'Tomas Vondra'" Cc: Subject: Re: serious problems with vacuuming databases Date: Mon, 10 Apr 2006 13:54:56 +0700 Keywords: Postgresql Message-ID: <003101c65c6b$ad079850$7f00a8c0@kicommunication.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcZcCvEJ3XbmTYlTRJSg/o3GxHkICwAXaavA In-Reply-To: <443950FB.4050707@fuzzy.cz> X-OriginalArrivalTime: 10 Apr 2006 06:54:56.0091 (UTC) FILETIME=[AD0882B0:01C65C6B] X-Archive-Number: 200604/189 X-Sequence-Number: 18273 Hi Tomas, Tomas wrote: We've decided to remove unneeded 'old' data, which means removing about 99.999% of rows from tables A, C and D (about 2 GB of data). At the beginning, the B table (containing aggregated from A, C and D) was emptied (dropped and created) and filled in with current data. Then, before the deletion the data from tables A, C, D were backed up using another tables (say A_old, C_old, D_old) filled in using ..... 1) drop, create and fill table B (aggregated data from A, C, D) 2) copy 'old' data from A, C and D to A_old, C_old a D_old 3) delete old data from A, C, D 4) dump data from A_old, C_old and D_old 5) truncate tables A, C, D 6) vacuum full analyze tables A, C, D, A_old, C_old and D_old ---- I think you do some difficult database maintainance. Why you do that, if you just want to have some small piece of datas from your tables. Why don't you try something like: 1. create table A with no index (don't fill data to this table), 2. create table A_week_year inherit table A, with index you want, and some condition for insertion. (eg: table A1 you used for 1 week data of a year and so on..) 3. do this step for table B, C and D 4. if you have relation, make the relation to inherit table (optional). I think you should read the postgresql help, for more information about table inheritance. The impact is, you might have much table. But each table will only have small piece of datas, example: just for one week. And you don't have to do a difficult database maintainance like you have done. You just need to create tables for every week of data, do vacuum/analyze and regular backup. Best regards, ahmad fajar,