Re: [ADMIN] copying data between tables
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. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [ADMIN] copying data between tables
On Fri, 27 Feb 2004 20:14:53 +0100, Jean-Michel Chabanne <[EMAIL PROTECTED]> 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 ---(end of broadcast)--- TIP 8: explain analyze is your friend
[ADMIN] unsubscribe
PLEASE take " [EMAIL PROTECTED] " off your e-mail list- __ Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis! http://antipopup.uol.com.br/ ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly