MySQL Import – How to Import TSV File into MySQL Table with SET Datatype Column

importmariadbMySQL

Is it possible to use LOAD DATA INFILE to load data into a MySQL/MariaDB table, where one column uses the SET datatype? My columns are separated by tab, my set members by comma.

If so, how do I specify the separator for the individual set elements?

Best Answer

The answer appears to be yes.

Set members are accepted if they are separated by comma, however there should be no space between the comma and the next set element.

Since commas are used to separate set members, columns must be separated by a different character. I have used tabs, and this works well.

Performance is greatly improved (roughly by a factor of 10-20), compared to joining with another table holding the set values.