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 06663D1E903 for ; Sun, 29 Feb 2004 00:18:35 +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 69392-06 for ; Sat, 28 Feb 2004 20:18:35 -0400 (AST) Received: from smtp2.actcom.co.il (smtp2.actcom.co.il [192.114.47.15]) by svr1.postgresql.org (Postfix) with ESMTP id 5BEBCD1E908 for ; Sat, 28 Feb 2004 20:18:31 -0400 (AST) Received: from machenai-2h2ozp (l192-117-119-164.broadband.actcom.net.il [192.117.119.164]) by smtp2.actcom.co.il (8.12.8/8.12.8) with ESMTP id i1T0ITjD030403; Sun, 29 Feb 2004 02:18:32 +0200 Cc: Postgres Admin List To: Jean-Michel Chabanne Subject: Re: copying data between tables References: <1077909293.1345.3.camel@yoyo.local> Message-ID: From: Tsirkin Evgeny Content-Type: text/plain; format=flowed; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Sat, 28 Feb 2004 14:18:45 +0200 In-Reply-To: <1077909293.1345.3.camel@yoyo.local> User-Agent: Opera7.20/Win32 M2 build 3144 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/394 X-Sequence-Number: 12567 On Fri, 27 Feb 2004 20:14:53 +0100, Jean-Michel Chabanne wrote: > 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. > > That would not make me able to know WHAT was the change: what was there befor and after the update