Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1957

Adding primary key to large InnoDB table (1 reply)

$
0
0
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?

Viewing all articles
Browse latest Browse all 1957

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>