1

Just need some advice here. Because I have a table that has 45,000 rows. What I did is I export the table as a multiple INSERT command. But the estimated time is too long. Which is faster to load in the sql? A rows that is exported as CSV or rows that exported as a multiple INSERT command?

2
  • But the estimated time is too long. - how did you get this estimation? Commented Nov 26, 2013 at 6:23
  • I run this in a SQL browser software Commented Nov 26, 2013 at 6:25

3 Answers 3

1

LOAD DATA INFILE is the fastest.

hello, so you are dumping table by your own program. if loading speed is important. please consider belows:

  • ensure that multiple INSERT INTO .. VALUES (...), (...)
  • Disable INDEX before loading, enable after loading. This is faster.
  • LOAD DATA INFILE is super faster than multiple INSERT but, has trade-off. maintance and handling escaping.

  • BTW, I thing mysqldump is better than others.

how long takes to load 45,000 rows?

Sign up to request clarification or add additional context in comments.

2 Comments

Ok sorry for my late reply. As of now it takes 35 mins. But it is not done yet.
@Jerielle thanks. as you know, load time depends your schema and data. but it's too late (2.15 rows per sec?). are you loading while there is another process? have you checked SHOW PROCESSLIST while loading?
1

INSERT is faster, because you are skip parsing of csv.

If your table at MyISAM, you can copy files: *.frm, *.myi, *.myd and this migration will be faster.

Comments

1

In my experience, loading a csv is almost always faster with large datasets; it is built for mass loading.

See here for more info https://dba.stackexchange.com/questions/16809/why-is-load-data-infile-faster-than-normal-insert-statements

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.