Quickly Load Very Large Data Sets into Your MariaDB Database
LOAD DATAcommand. In this example here, I connected via `ssh` to my server and uploaded all of the world's postal codes from opendatasoft into a database table.
johnny@server [~/postal-code-data]# mysql -user=db_user -password=DB-pwd
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 29899
Server version: 10.2.31-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use xyz_db
Database changed
MariaDB [xyz_db]> LOAD DATA LOCAL INFILE 'geonames-postal-code.csv'
>INTO table geo_postal_codes fields terminated by ';';
Query OK, 1433484 rows affected, 65535 warnings (1 min 2.79 sec)
Records: 1433484 Deleted: 0 Skipped: 0 Warnings: 5733970
Not too bad! 1.4 million records in about 1 min... Now, I need to go figure out what the warnings were...
Comments
Post a Comment