table manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a large database (20 Gb) on PostgreSQL 8.1.0 where I need to make a copy of the structure and also copy the data from a few of the tables (approximately 40 out of 140, resulting database is approximately 10 Mb) which have dependencies on each other. The problem I am having is finding the best way to go about this using an automated script. There were a few options I could think of:

1) copy the whole large database and then truncate the tables I didn't need (the tables I need have a specific naming scheme). This seems wasteful and can take up to 5 hours to do. 2) copy the schema from the database and then dump just the tables I want and restore them on the new database. The problem I run into here is the inter-dependencies between some of the tables makes this hard to do programmatically (I could hard code the order list of which tables to fill, but then what happens when we add more tables?)

Are there other approaches that I'm missing here? I need to do this across several databases which have basically the same structures and naming schemes but the dependencies on all of the databases are different. I'm trying to come up with a generic solution that I can use for all of the databases without having to maintain the dependencies for each.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux