How to import data to mysql is highly efficient

Source: Internet
Author: User

How to import data to mysql is highly efficient. To import data to mysql databases, You need to import data to an Excel data file. First, you must construct the excel data file according to the corresponding table fields, convert it to the SQL statement of insert, and then insert it into the database. At first, I did not consider execution efficiency. After I converted it into an SQL statement, I used navicat as the database Viewing Interface, and then created a new query to paste the constructed SQL statement into it and execute it, then the SQL statement started to run wildly. It took over 30 thousand seconds to execute more than eight hundred records. It took 14 minutes. It was too slow. I didn't pay attention to it at the time. Later, it was found that some of the imported data had problems due to the excel format, so it was re-constructed and then imported to the database. It's a long wait... So I started to think about it: it seems that it is not so slow to export a table as an SQL statement and then execute the whole database! I made the SQL statement into an SQL file and executed it as a file. As a result, the execution was completed in over a dozen seconds. Conclusion: executing SQL statements in the form of files is much more efficient than executing SQL statements in new query statements.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.