I'm importing a lot (only ~10,000) of employees and then making them all a user account at once. Inserting into my user_profile table is slowing everything down a ton because the primary key of the table is a foreign key as well, and not the usual autoincrement id.
Is there any way to speed this up? Or do I need to go back and add an autoincrement id to user_profile somehow?
Edit:
user:
id
username
salt
password
user_profile:
user_id -> Primary Key and Foreign Key to user table
first_name
last_name
email
...
My recommendation is to add a id
field to the user_profile
table, make it the primary key (unsigned and auto_increment). Then make the user_id
field the foreign key to the user ( id
) table. I've never seen a field act as the primary key AND foreign key to another table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.