0
加載一個包含3百萬條記錄的文件需要幾個小時,每列只包含兩個字段,即ID和Name。慢度與其他表格的關係有什麼關係?我加載數據表是在許多一對多關係的交集表:爲什麼將數據加載到mysql表中的速度如此之慢
MariaDB [wordDS]> describe Category_Term;
+---------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------+------+-----+---------+-------+
| categories_id | bigint(20) | NO | PRI | NULL | |
| terms_id | bigint(20) | NO | PRI | NULL | |
+---------------+------------+------+-----+---------+-------+
兩個ID只是外鍵的父表,類別和期限的主鍵。當我加載主表時,它似乎快得多。您是否認爲由於外國參考,裝載速度會變慢?或者它沒有任何關係。
這是更多的信息,並希望它有幫助。
MariaDB [wordDS]> show processlist;
+----+----------+-----------+------------+---------+------+--------------+------------------------------------------------------------------------------------------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----+----------+-----------+------------+---------+------+--------------+------------------------------------------------------------------------------------------------------+----------+
| 3 | ling | localhost | wordDS | Query | 0 | init | show processlist | 0.000 |
| 9 | ling | localhost | wordDS | Query | 2564 | reading file | LOAD DATA LOCAL INFILE 'C_T01.txt' INTO TABLE Category_Term FIELDS TERMINATED BY '\t' LINES TERMINA | 0.000 |
+----+----------+-----------+------------+---------+------+--------------+------------------------------------------------------------------------------------------------------+----------+
2 rows in set (0.00 sec)
有關此問題的任何意見或知識? – user697911