Unix Technical Forum

Copying DB to new structure

This is a discussion on Copying DB to new structure within the MySQL General forum forums, part of the MySQL category; --> We have a moderately sized database, more than 5GB in size, several million rows and 70 tables. We're running ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:25 AM
Russell Horn
 
Posts: n/a
Default Copying DB to new structure

We have a moderately sized database, more than 5GB in size, several
million rows and 70 tables.

We're running MySQL 5.22 and the database uses innodb throughout with
multiple foreign keys in use.

During development the structure of several tables has been changed many
times, such that we now have a number of rendundent columns.

We've created a new, empty database with our proposed new structure and
I'm now looking for the most efficient way to get our existing data into
this new structure, dropping any data in columns that no longer exist.
Can anyone propose a sensible way to go about this?

Because we're using innodb, dropping columns one at a time takes an age
as every index is rebuilt. Just laoding the database from a mysqldump
file takes about five hours so I'm pretty sure we'll want to load data
from our old database into the new db with the new structure - if anyone
can recommend a strategy to do that, or suggest an alternative, I'd be
most appreciative!

Thanks,

Russell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:25 AM
Mikhail Berman
 
Posts: n/a
Default RE: Copying DB to new structure

Well,

Maybe 70 pairs of "select into outfile" - "load data infile". At least,
this way you can select only columns you want to be in your new
database.

Best,

Mikhail Berman

-----Original Message-----
From: Russell Horn [mailto:mysqllists@albanach.com]
Sent: Wednesday, December 13, 2006 12:41 PM
To: mysql@lists.mysql.com
Subject: Copying DB to new structure

We have a moderately sized database, more than 5GB in size, several
million rows and 70 tables.

We're running MySQL 5.22 and the database uses innodb throughout with
multiple foreign keys in use.

During development the structure of several tables has been changed many
times, such that we now have a number of rendundent columns.

We've created a new, empty database with our proposed new structure and
I'm now looking for the most efficient way to get our existing data into
this new structure, dropping any data in columns that no longer exist.
Can anyone propose a sensible way to go about this?

Because we're using innodb, dropping columns one at a time takes an age
as every index is rebuilt. Just laoding the database from a mysqldump
file takes about five hours so I'm pretty sure we'll want to load data
from our old database into the new db with the new structure - if anyone
can recommend a strategy to do that, or suggest an alternative, I'd be
most appreciative!

Thanks,

Russell

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=mberman@ivesinc.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:28 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com