Skip site navigation (1) Skip section navigation (2)

Re: copying data between tables

From: Jean-Michel Chabanne <jeanmichel(dot)chabanne(at)online(dot)fr>
To: Tsirkin Evgeny <tsurkin(at)mail(dot)jct(dot)ac(dot)il>
Cc: Postgres Admin List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: copying data between tables
Date: 2004-02-27 19:14:53
Message-ID: 1077909293.1345.3.camel@yoyo.local (view raw or flat)
Thread:
Lists: pgsql-admin
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.



In response to

Responses

pgsql-admin by date

Next:From: Anjan DaveDate: 2004-02-27 19:46:05
Subject: Re: pg_restore data block error
Previous:From: mallahDate: 2004-02-27 17:46:39
Subject: Re: ALTER table taking ages...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group