I'm new to SQL, and I see this question has been asked many times, but none of the answers have helped me. So I'm hoping to get feedback on my situation.
I am trying to load a tab-delimited file with about 1.5 million rows and 48 columns. Each field is enclosed with double quotes. My query ran for over an hour and I killed it. Here is what I did:
CREATE TABLE mytable (
*48 variable declarations given types varchar, int, or decimal*,
PRIMARY KEY (id)
);
load data local infile 'MyFile.tsv'
into table mytable
fields terminated by '\t'
enclosed by '"'
lines terminated by '\n' IGNORE 1 LINES
(*comma separated list of all 48 variable names in 'mytable'*);
Is there something obviously that I'm missing that is blowing up the runtime of this query? I was careful to declare variables with only enough space as needed. So if I have an integer field with up to 3 digits, it is declared as myfield int(3)
.