I have a MySQL database that I’d like to test the performance of. I want to insert approximately 5 million records into a table with an auto-incremented primary key. Is there an easy way to do this quickly with SQL? I know I can pipe in a .sql file, but all I really want to do is insert the same identical data (but with a different PK), 5 million times.
Share
You can insert NULL as the value of the PK or just simply don’t specify it in the columns list in your insert statement. That way it gets auto incremented.