Re: Importing large databases faster

2009-12-18 Thread Brent Clark

On 17/12/2009 17:46, mos wrote:

Load Data ... is still going to be much faster.

Mike



Hiya

If you using on Linux and using LVM, look at mylvmbackup.

HTH

Brent Clark

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



Re: Importing large databases faster

2009-12-17 Thread Jay Ess

Madison Kelly wrote:

Hi all,

I've got a fairly large set of databases I'm backing up each Friday. 
The dump takes about 12.5h to finish, generating a ~172 GB file. When 
I try to load it though, *after* manually dumping the old databases, 
it takes 1.5~2 days to load the same databases. I am guessing this is, 
at least in part, due to indexing.


My question is; Given an empty target DB and a dump file generated via:

ssh r...@server mysqldump --all-databases -psecret  
/path/to/backup.sql
I use the -e -v -f -q -Q -K parameters for the mysqldump on large 
tables/databases. It does what you are asking for. Disables the key 
generation until all of the data is inserted. It also uses multi insert 
statements and not individual insert statement for every row which 
speeds up things considerable.


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



Re: Importing large databases faster

2009-12-17 Thread mos

At 03:59 AM 12/17/2009, you wrote:

Madison Kelly wrote:

Hi all,

I've got a fairly large set of databases I'm backing up each Friday. The 
dump takes about 12.5h to finish, generating a ~172 GB file. When I try 
to load it though, *after* manually dumping the old databases, it takes 
1.5~2 days to load the same databases. I am guessing this is, at least in 
part, due to indexing.


My question is; Given an empty target DB and a dump file generated via:

ssh r...@server mysqldump --all-databases -psecret  /path/to/backup.sql
I use the -e -v -f -q -Q -K parameters for the mysqldump on large 
tables/databases. It does what you are asking for. Disables the key 
generation until all of the data is inserted. It also uses multi insert 
statements and not individual insert statement for every row which speeds 
up things considerable.



Load Data ... is still going to be much faster.

Mike 



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



Importing large databases faster

2009-12-16 Thread Madison Kelly

Hi all,

I've got a fairly large set of databases I'm backing up each Friday. The 
dump takes about 12.5h to finish, generating a ~172 GB file. When I try 
to load it though, *after* manually dumping the old databases, it takes 
1.5~2 days to load the same databases. I am guessing this is, at least 
in part, due to indexing.


My question is; Given an empty target DB and a dump file generated via:

ssh r...@server mysqldump --all-databases -psecret  /path/to/backup.sql

How can I go about efficiently loading it into a new database? 
Specifically, can I disable triggers, indexes and what not until after 
load finishes? I can only imagine that a single ok, go create your 
indexes now at the end would be faster. Perhaps some way to hold off 
commits from happening as often? The target server has 32Gb of RAM, so I 
suspect I should be able to hold things in memory and commit to disk 
relatively rarely.


I am currently loading via this command:

mysql -psecret  /path/to/backup.sql

The source and destination MySQL versions are:

Source:
mysql  Ver 14.13 Distrib 5.1.19-beta, for unknown-linux-gnu (x86_64) 
using readline 5.0


Dest:
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using 
readline 5.1


The reason for the discrepancy is that the old server was setup from 
source on CentOS 4.x by a previous tech and the destination server is 
the stock version from CentOS 5.x. The source server will be phased out 
soon, so no real attempt at maintaining matching versions was done.


Thanks!

Madi

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



RE: Importing large databases faster

2009-12-16 Thread Gavin Towey
There are scripts out there such at the Maatkit mk-parallel-dump/restore that 
can speed up this process by running in parallel.

However if you're doing this every week on that large of a dataset, I'd just 
use filesystem snapshots.  You're backup/restore would then only take as long 
as it takes for you to scp the database from one machine to another.

Regards,
Gavin Towey


-Original Message-
From: Madison Kelly [mailto:li...@alteeve.com]
Sent: Wednesday, December 16, 2009 12:56 PM
To: mysql@lists.mysql.com
Subject: Importing large databases faster

Hi all,

I've got a fairly large set of databases I'm backing up each Friday. The
dump takes about 12.5h to finish, generating a ~172 GB file. When I try
to load it though, *after* manually dumping the old databases, it takes
1.5~2 days to load the same databases. I am guessing this is, at least
in part, due to indexing.

My question is; Given an empty target DB and a dump file generated via:

ssh r...@server mysqldump --all-databases -psecret  /path/to/backup.sql

How can I go about efficiently loading it into a new database?
Specifically, can I disable triggers, indexes and what not until after
load finishes? I can only imagine that a single ok, go create your
indexes now at the end would be faster. Perhaps some way to hold off
commits from happening as often? The target server has 32Gb of RAM, so I
suspect I should be able to hold things in memory and commit to disk
relatively rarely.

I am currently loading via this command:

mysql -psecret  /path/to/backup.sql

The source and destination MySQL versions are:

Source:
mysql  Ver 14.13 Distrib 5.1.19-beta, for unknown-linux-gnu (x86_64)
using readline 5.0

Dest:
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using
readline 5.1

The reason for the discrepancy is that the old server was setup from
source on CentOS 4.x by a previous tech and the destination server is
the stock version from CentOS 5.x. The source server will be phased out
soon, so no real attempt at maintaining matching versions was done.

Thanks!

Madi

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


This message contains confidential information and is intended only for the 
individual named.  If you are not the named addressee, you are notified that 
reviewing, disseminating, disclosing, copying or distributing this e-mail is 
strictly prohibited.  Please notify the sender immediately by e-mail if you 
have received this e-mail by mistake and delete this e-mail from your system. 
E-mail transmission cannot be guaranteed to be secure or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any loss or damage caused by viruses or errors or omissions in the contents 
of this message, which arise as a result of e-mail transmission. [FriendFinder 
Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089, USA, FriendFinder.com


Re: Importing large databases faster

2009-12-16 Thread Madison Kelly

Gavin Towey wrote:

There are scripts out there such at the Maatkit mk-parallel-dump/restore that 
can speed up this process by running in parallel.

However if you're doing this every week on that large of a dataset, I'd just 
use filesystem snapshots.  You're backup/restore would then only take as long 
as it takes for you to scp the database from one machine to another.

Regards,
Gavin Towey


Thanks! Will the Maatkit script work on a simple --all-databases dump?

As for the copy, it's a temporary thing. This is just being done weekly 
while we test out the new server. Once it's live, the new server will 
indeed be backed up via LVM snapshots. :)


Madi

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



RE: Importing large databases faster

2009-12-16 Thread Gavin Towey
I don't think so, I'm pretty sure you have to use mk-parallel-dump to get the 
data in a format it wants.  The docs are online though.

Regards,
Gavin Towey

-Original Message-
From: Madison Kelly [mailto:li...@alteeve.com]
Sent: Wednesday, December 16, 2009 4:35 PM
To: Gavin Towey
Cc: mysql@lists.mysql.com
Subject: Re: Importing large databases faster

Gavin Towey wrote:
 There are scripts out there such at the Maatkit mk-parallel-dump/restore that 
 can speed up this process by running in parallel.

 However if you're doing this every week on that large of a dataset, I'd just 
 use filesystem snapshots.  You're backup/restore would then only take as long 
 as it takes for you to scp the database from one machine to another.

 Regards,
 Gavin Towey

Thanks! Will the Maatkit script work on a simple --all-databases dump?

As for the copy, it's a temporary thing. This is just being done weekly
while we test out the new server. Once it's live, the new server will
indeed be backed up via LVM snapshots. :)

Madi

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


This message contains confidential information and is intended only for the 
individual named.  If you are not the named addressee, you are notified that 
reviewing, disseminating, disclosing, copying or distributing this e-mail is 
strictly prohibited.  Please notify the sender immediately by e-mail if you 
have received this e-mail by mistake and delete this e-mail from your system. 
E-mail transmission cannot be guaranteed to be secure or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any loss or damage caused by viruses or errors or omissions in the contents 
of this message, which arise as a result of e-mail transmission. [FriendFinder 
Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089, USA, FriendFinder.com


Re: Importing large databases faster

2009-12-16 Thread Shawn Green

Madison Kelly wrote:

Hi all,

I've got a fairly large set of databases I'm backing up each Friday. The 
dump takes about 12.5h to finish, generating a ~172 GB file. When I try 
to load it though, *after* manually dumping the old databases, it takes 
1.5~2 days to load the same databases. I am guessing this is, at least 
in part, due to indexing.


My question is; Given an empty target DB and a dump file generated via:

ssh r...@server mysqldump --all-databases -psecret  /path/to/backup.sql

How can I go about efficiently loading it into a new database? 
Specifically, can I disable triggers, indexes and what not until after 
load finishes? I can only imagine that a single ok, go create your 
indexes now at the end would be faster. Perhaps some way to hold off 
commits from happening as often? The target server has 32Gb of RAM, so I 
suspect I should be able to hold things in memory and commit to disk 
relatively rarely.


I am currently loading via this command:

mysql -psecret  /path/to/backup.sql



For that kind of dump, that kind of restore is what you get. Your 
current dump is generating GB of INSERT statements that need to be 
parsed then processed.


To get a faster restore, use a different sort of dump. I suggest you 
compare your current process to one that uses the --tab option of 
mysqldump (to save the data) then uses LOAD DATA INFILE ... to 
repopulate your server.  This is the fastest known method to populate a 
table other than a direct file copy.

--
Shawn Green, MySQL Senior Support Engineer
Sun Microsystems, Inc.
Office: Blountville, TN



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