7

Since I am involved in a multi-developer, version-controlled setup, I do a lot of database importing and exporting from environments.

I notice today that when I export a database from one of our sites using the control panel "Backup Database" function, it comes out at about 3.6MB and takes about 5 minutes to import.

When I export from Sequel Pro, the database dump comes out at about 1.6MB and imports within 30 seconds.

Note, I always dump the existing tables before import.

Just wondering what the difference is here that there is such a difference in file size and import time and which way is best?

Thanks!

2 Answers 2

10

The difference in both size and speed is likely because Sequel Pro (and any other MySQL client) is likely using mysqldump, which is a native CLI command and highly optimized.

Craft can't rely on that for a variety of reasons (PHP might have have exec permissions, the account Craft uses to connect to the database might not have the permissions necessary to perform a backup, etc.)

So Craft has it's own fallback where it manually analyzes the database's DML and DDL and writes it out to a file.

Slower? Yes. Larger file size? Yes. More reliable for Craft? Yes.

It is on our list somewhere to check if Craft has the ability to access mysqldump and use that, if not fall back to our current method.

2
  • So with that being said, should I only be using the craft backup method or is the dump out of Sequel Pro fine? I am willing to use the larger/longer method if you think it will help something. Otherwise it's a PITA. :-)
    – Jacob Graf
    Jul 15, 2014 at 23:01
  • Feel free to use whatever method you want / are comfortable with. They both will do the job.
    – Brad Bell
    Jul 15, 2014 at 23:04
3

Not an expert

EDIT: Brad is, see his post

From what I have noticed, the difference seems to be merely one of syntax in the way SQL dump are written. Sequel pro is more generic (and also more optimised as Brad explains). Craft creates files that are tailored for Craft and the way it works.

I have used both indifferently and never had any problem, although I tend to go with Craft generated ones lately.

2
  • 1
    lol - I still voted yours up. :)
    – Brad Bell
    Jul 15, 2014 at 19:51
  • That's because you're a softy Jul 15, 2014 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.