Is piping to MySQL slower than redirecting a file to stdin?
I am importing an 8 gigabyte MySQL dump file into the database. I used this command:
cat dumpfile.sql | mysql -u root -D mydatabase -p
It takes a lot of time! Will this approach be faster?
mysql -u root -D database -p < dumpfile.sql
The team works for 1.5 days - will the second approach save significant time?
+3
source to share
1 answer
Since the two versions have two syntaxes to achieve the same effect, sending dumpfile.sql
to the stdin of the mysql process, the times they take will be pretty much the same.
The first version starts an additional process - cat
- which the second approach does not, but you can expect the overhead to cat
be negligible compared to importing the actual data into mysql.
+4
source to share