4
I have a DER that represents an airport and I have to upload data from several csv. for example I have a 1-to-many connection, by plane for flights. If I have this table connected with the foreign key it gives me error to load the data so I did not enter links. I am then doing by joins. I’m doing the following consultation:
Use tese;
create table aviao1
(select a.tailnum, a.type, a.manufacturer, a.issue_data, a.model, a.status, a.aircraft_type, a.engine_type, a.year, c.uniquecarrier
From aviao a
INNER JOIN voos c
ON a.tailnum = c.tailnum )
To Tail number is my primary key on the plane table and on the flight table is my foreign key. Both are contained in the plane and flight csv. So I see which ones match and create a new plane table with the keys that match. The problem is, when I go to the doctor, he’s been running for over nine hours and he’s not done. It is normal to take so much time or there is a way to make this process faster?
Remove primary key, indexes, and any other constraints that create indexes (such as
UNIQUE
). After importing the data, add the constraints. I won’t put as an answer because I don’t know how to do this in Mysql.– Vinícius Gobbo A. de Oliveira
It wouldn’t be a load problem on your server?
– Tiago
So I load everything first without defining any primary or secondary keys? Regarding I in the import I have to select this otherwise load me repeated fields :/ After entering the data in the tables I can then connect them through the keys without doing the Inner Join? mysql does this automatically when selecting which foreign key?
– Gonçalo
Not because I’ve done with less data and loads fast (2 h max).
– Gonçalo