X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5A2ABD1B9A8 for ; Fri, 27 Feb 2004 19:15:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 83673-08 for ; Fri, 27 Feb 2004 15:14:56 -0400 (AST) Received: from postfix4-2.free.fr (postfix4-2.free.fr [213.228.0.176]) by svr1.postgresql.org (Postfix) with ESMTP id EA56FD1B97B for ; Fri, 27 Feb 2004 15:14:54 -0400 (AST) Received: from [192.168.222.7] (lns-th2-4f-81-56-183-148.adsl.proxad.net [81.56.183.148]) by postfix4-2.free.fr (Postfix) with ESMTP id E39BB7FCE9; Fri, 27 Feb 2004 20:14:53 +0100 (CET) Subject: Re: copying data between tables From: Jean-Michel Chabanne To: Tsirkin Evgeny Cc: Postgres Admin List In-Reply-To: References: Content-Type: text/plain; charset=iso-8859-15 Message-Id: <1077909293.1345.3.camel@yoyo.local> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Fri, 27 Feb 2004 20:14:53 +0100 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/393 X-Sequence-Number: 12566 Le ven 27/02/2004 à 03:40, Tsirkin Evgeny a écrit : > Hi all! > I have the following task : > I have some tables edited (insert/update) by users. > I should create a file (in whatever format) containing > changes of the last day,every day.What I have currently > is : > I have two tables of the same structer ,every day i : > > select * from newtable > except > select * from oldtable > > And then format the data with perl script.After that ,i > am copying the data from the new table to the old table .It > works pretty good except that the copying is VERY slow: > I use : > insert into old from (select * from newtable); > > Is there any more afficient way to do what i need , > that somebody already use? > Is there any more afficient way to copy data between > tables? > I know that i can use COPY to copy files from > and to files ,can it be used here? > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > If I had to do this, I would use triggers which, on every INSERT/UPDATE by users, would insert the new item + timestamp or date in a new table. I hope this will help you.