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 52E77D1E16C for ; Fri, 27 Feb 2004 14:40:52 +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 87901-06 for ; Fri, 27 Feb 2004 10:40:22 -0400 (AST) Received: from smtp2.actcom.co.il (smtp2.actcom.co.il [192.114.47.15]) by svr1.postgresql.org (Postfix) with ESMTP id 8B22ED1E14A for ; Fri, 27 Feb 2004 10:40:04 -0400 (AST) Received: from machenai-2h2ozp (l192-117-121-121.broadband.actcom.net.il [192.117.121.121]) by smtp2.actcom.co.il (8.12.8/8.12.8) with ESMTP id i1REdqjD008775 for ; Fri, 27 Feb 2004 16:39:56 +0200 Date: Fri, 27 Feb 2004 04:40:12 +0200 To: pgsql-admin@postgresql.org Subject: copying data between tables From: Tsirkin Evgeny Content-Type: text/plain; format=flowed; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera7.20/Win32 M2 build 3144 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/378 X-Sequence-Number: 12551 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?