Thesql load data infile takes too long and db file grows too large

MySQL

I am trying to import pretty large file (3.5G with 39mlm rows) with

set foreign_key_checks=0; 
set sql_log_bin=0; 
set unique_checks=0;
load data infile '/var/lib/mysql-files/2.csv' ignore 
into table main_data fields terminated by ','  
optionally enclosed by '"' 
lines terminated by '\n' 
ignore 1 rows (col, col2, col3);

It already passed like 24 hours, and database file in /var/lib/mysql/MyDB grow to 11G, I am not sure why, because the file I import from is less than 4G.
It is mysql 8.0. The only things I added to config is

innodb_buffer_pool_size = 22G
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
innodb_autoinc_lock_mode=2

I think if I batch insert these data it would be faster…

As suggester in 1st comment here is creat table syntax.
I now think that so many indexes can be the issue with size and time :

CREATE TABLE `main_data` (
  `file_name` tinyint(4) NOT NULL,
  `line_number` int(11) NOT NULL,
  `link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `doc_type` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_keywords` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_description` text COLLATE utf8mb4_unicode_ci,
  `language` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `done` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`file_name`,`line_number`),
  UNIQUE KEY `link_UNIQUE` (`link`),
  KEY `done_idx` (`done`),
  KEY `lang_idx` (`language`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

I only import 1st three columns (file_name, line_number, link), rest are nulls.

Best Answer

24 hours is a very long time- the most important factor when running LOAD DATA is the buffer pool, and yours (22GB) should be enough to accommodate the imported 3.5G file. Something else must be going on, please share more data like the SHOW CREATE TABLE output for the used table and SHOW PROCESSLIST- maybe there is something blocking the table and you are waiting for the process to start. You can check at any time the state of the load by checking the GLOBAL STATUS for innodb%' as well as theHandler_writes`.

To give you an idea of how much I would expect this to take, a 3.7 GB file should not take much more than 200 seconds to safely load on an SSD desktop-grade machine. See these tests I did not a long time ago on all recent MariaDB and MySQL versions on a non-server grade machine, even on a default (bad) config: https://dbahire.com/testing-again-load-data-on-mysql-5-6-5-7-8-0-non-ga-and-mariadb-10-0-10-1-and-10-2-non-ga/