Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 839314758BB for ; Tue, 27 Aug 2002 08:36:55 -0400 (EDT) Received: from ias.digitro.com.br (unknown [200.247.100.134]) by postgresql.org (Postfix) with ESMTP id 3855C474E4E for ; Tue, 27 Aug 2002 08:36:54 -0400 (EDT) Received: from serverdgt.daf.digitro.com.br (serverdgt.daf.digitro.com.br [192.2.2.10]) by ias.digitro.com.br (8.11.6/8.11.1) with ESMTP id g7RCWRb23423 for ; Tue, 27 Aug 2002 09:32:27 -0300 Received: from dgtac ([192.168.160.152]) by serverdgt.daf.digitro.com.br (8.11.1/8.8.7) with SMTP id g7RCaYt27577 for ; Tue, 27 Aug 2002 09:36:34 -0300 Message-ID: <016e01c24dc6$5bf743f0$98a0a8c0@dgtac> From: "Vilson farias" To: References: <20020826124628.C64199-100000@megazone23.bigpanda.com> Subject: Re: Deleting large amount of data. Date: Tue, 27 Aug 2002 09:36:24 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/310 X-Sequence-Number: 5424 Thanks for ask my post, Mr. Szabo. Thanks for worry about my performance problems, but they are natural for my database, once my hardware isn't a Ferrari and my table has more than 2 milion of touples and it's related with a lot of other very high populated tables. I realized I can keep no longer than 6 mounths of data in these tables, so I would like to remove older data every night. I didn't write any code yet and I can't start testing the best way in my databases, so I'm posting here to get some advices. I'm worried about performance problems that could raise when a start removing 12000 touples in a single transaction once I don't know how PostgreSQL works internally. Can a single transaction deal with so many data without problem or overloading transaction buffers (or something like that) or do I need to split deletion process in smaller sets of data? My main table wich has more than 2milion of touples : CREATE TABLE cham_chamada ( cod_bxs integer NOT NULL, chave integer NOT NULL, identificacao integer NOT NULL, dt_inicial timestamp NOT NULL, indicadora integer, cod_categoria integer, identidadea varchar(20), dt_final timestamp , juntor integer, indicadorb integer, identidadeb varchar(20), flg_chamada char(1), flg_liberacao char(1), temp_total integer, ddd smallint, cod_liberjuntor integer, cod_resultcham integer, cod_fds integer, cifra_origem integer, csp char(2), conta integer, ramal varchar(20), ultimo_ramal varchar(20), CONSTRAINT XPKcham_chamada PRIMARY KEY (dt_inicial, cod_bxs, chave, identificacao) ) ; CREATE INDEX XIE1cham_chamada ON cham_chamada ( dt_final , identidadea ); CREATE INDEX XIE2cham_chamada ON cham_chamada ( dt_final , flg_chamada );