views:

214

answers:

3

I have an existing database with tables which each have 4 partitions (there are tables using both RANGE and HASH partitioning).

I need to import it into another database with a pre-created schema where the same tables will have 8 partitions.

How do I do this? Does this "just work" if I do a table-level import?

A: 

It depends if the partition values are the same. If 4 of the partitions in the new table have the same partition values as the old table, then you can import into a table set up the same as the old table, then split the partitions as necessary to get your 8 new partitions.

thecoop
A: 

If you are not too much concerned about performance, just treat the process as moving data from one table to another. The platform will take of the rest.

Ryan Bates
that's the "it just works" outcome? A table-level import will just sort things out? Good news, if so (as we're not that bothered about performance, the db is not huge right now and it's a one-off migration)
Paul
I have had success with a INSERT INTO new_table SELECT col1, col2, col3 FROM old_table, where the partitions on old_table and new_table were not the same, so yes. Unless there are specific constraints to factor in, it may well work.
Ryan Bates
+3  A: 

Yes. Use the IGNORE=Y setting and have the table precreated in the target schema/database the way you want it physically organized. The main problem you can run into is if you don't have the same "coverage" in the target system -- if there aren't partitions/subpartitions that can hold all the data you're importing from the source.

Adam Musch