Hi
I have a table with around 30 million rows. The table does not have a primary key, but has a foreign key to another table. There are on average around 10 rows in this table for each row in the other table (i.e. there are around 3 million rows in the other table).
I want to add a primary key to the larger table (there is already one on the smaller table) and am not sure how best to go about this.
I understand InnoDB has an internal record ID and was wondering if I could use that somehow. How do I access it?
Or would it be better to SELECT INTO OUTFILE... add an ID field to the file and then LOAD FILE again after recreating the table with the primary key?
I have a table with around 30 million rows. The table does not have a primary key, but has a foreign key to another table. There are on average around 10 rows in this table for each row in the other table (i.e. there are around 3 million rows in the other table).
I want to add a primary key to the larger table (there is already one on the smaller table) and am not sure how best to go about this.
I understand InnoDB has an internal record ID and was wondering if I could use that somehow. How do I access it?
Or would it be better to SELECT INTO OUTFILE... add an ID field to the file and then LOAD FILE again after recreating the table with the primary key?