Re: Copying data from table to table (cloned tables)
От | daq |
---|---|
Тема | Re: Copying data from table to table (cloned tables) |
Дата | |
Msg-id | 5168869156.20061010112228@ugyvitelszolgaltato.hu обсуждение исходный текст |
Ответ на | Copying data from table to table (cloned tables) ("Fourat Zouari" <fourat@gmail.com>) |
Список | pgsql-novice |
FZ> Hello all, FZ> Any one could suggest the best way to copy data from table to table in the FZ> same db, the reason why am seeking for this is that the first table is FZ> becoming very big, and old data has no reason why to stay there, so i FZ> created a cloned table but without indexes and constraints (lighter) and now FZ> i would like to copy 'some' data from first to second table (copied data is FZ> data older than 3 months, i have a timestamp column). FZ> In other way, i have a table called 'hotqueues' where i store fresh messages FZ> queued, once messages are treated, they stay in 'hotqueues' but with a flag FZ> indicating that their arent queued for treatment.. FZ> so in this way, data will rest there forever, slowing down any searches in FZ> that table, the solution was to copy old messages to another table called FZ> 'coldqueues' that has the same structure as 'hotqueues' but lighter (without FZ> constraints and indexes). FZ> How to copy these data with 100% data-loose free. FZ> Thanks for any help you can provide. A simple solution: INSERT INTO coldqueues SELECT * FROM hotqueues where ...; See documentation page: http://www.postgresql.org/docs/8.1/static/sql-insert.html DAQ
В списке pgsql-novice по дате отправления: