r/mysql • u/Lefkios_M • Nov 12 '24
question Huge time needed to import a database
I am university student, working on a project for one of my classes. This is my first time using MySql and i an trying to import, using import wizard, a 1GB .cxl file. My laptop (with 16 gb ram) is running for 24+ hours and the import isnt done yet. Is this normal?
1
Upvotes
3
u/squadette23 Nov 12 '24
No.
2
u/Irythros Nov 13 '24
If you are importing in a table/tables with indices, disable them until after the import.
2
u/evilbytez Nov 13 '24
MySQL is not the same as MySQL Workbench. This is why this is slow, do not use the import wizard, it's horrific.
Do you know how to access your MySQL shell on your server? Start there.
2
u/Outdoor_Releaf Nov 13 '24
For 1 GB, I think the following will work:
Go to YouTube and look for: Load Big FIles FAST ON x where x is "Macs" or "Windows".
The problem with the Table Data Import Wizard is that it runs a separate transaction for each row.
1
u/kadaan Nov 12 '24
1
u/muthurajkumar-y Nov 13 '24
You are trying to import a Excel into table right ?
1
u/dipak1590 Nov 14 '24
Recommendations to Speed Up the Import
LOAD DATA INFILECommand: Instead of the Import Wizard, try using theLOAD DATA INFILESQL command, which is much faster for large files. It’s specifically designed for bulk imports. Here’s a basic command:Make sure the file is accessible to MySQL, and check permissions if needed.sqlCopy code LOAD DATA INFILE 'path/to/your/file.csv' INTO TABLE your_table FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;Adjust MySQL Settings:
innodb_buffer_pool_size: This can allow MySQL to handle larger datasets more efficiently.max_allowed_packetto a higher value**: Large rows or values could be hitting the packet size limit.autocommitto0can help reduce transaction overhead during the import.LOAD DATA INFILEis not an option, consider splitting the.csvfile into smaller chunks (e.g., 100MB each) and importing them sequentially. There are tools likespliton Linux and third-party programs on Windows that can split large files quickly.mysqlormysqldump(for imports from other MySQL databases) can be more efficient, as they don’t have the overhead of a GUI and can be directly optimized for performance.Example of LOAD DATA INFILE for a Large .csv
secure-file-privis disabled or set to a directory you can access.LOAD DATA INFILEcommand as shown above from the MySQL command line.Additional Tips
If you follow these steps, your import process should be significantly faster than using the Import Wizard alone.
1
u/99zforgetaboutit Feb 19 '25
Which O/S is on your laptop?