Reputation: 1498
I believe this is not possible, but I ask here to be sure.
Here are my thoughts:
Since I am doing an insert...select, I cannot generate the ids from the application.
So, basically, what would be perfect would be to have an auto increment that does not need to be indexed.
I don't understand why mysql need an index to implement auto increment? cannot simply store the last inserted id and then increment it?
Any input is welcome!
Upvotes: 0
Views: 561
Reputation: 204766
You can generate an ID like this
insert into destination_table (col_id, col2, col3)
select @rank := @rank + 1, colX, colY
from source_table
cross join (select @rank := 0) r
order by some_column
Upvotes: 0