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

Advice on moving rows to history

From: Dave Smith <dave(dot)smith(at)candata(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Advice on moving rows to history
Date: 2004-12-29 21:58:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I am trying to figure out the fastest way to move rows from a current
table to a history table. There are currently 150,000 rows of which
about 60,000 get moved (monthly). There are multiple queries involved to
figure out whether or not a row should be moved, so I am making multiple
passes over the table. Right now I see two options 

1) Write a function that inserts a row into the history table and then
removes it from the current
2) Have a status flag that marks the rows for history and then insert
them into the history table then remove all of these rows from the

I would like to know what other peoples experiences have been with this
problem, and what would you suggest.

Dave Smith
CANdata Systems Ltd

pgsql-general by date

Next:From: Tom LaneDate: 2004-12-29 22:11:45
Subject: Re: pg_dump and pgpool
Previous:From: Eric BrownDate: 2004-12-29 21:38:42
Subject: debug_print_plan (pg7.4) doesn't seem to do anything

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