简体   繁体   中英

add a numeric index in mysql table

I have a table with 6 columns having two columns jointly acting as a primary key.

However, I now want to add a numeric index column for each row in the table, so that I can fetch a specific number of rows at a time and keep track to fetch new data every time.

Sorting the current columns would take a lot of time each time as the table is huge.

What can be the best solution?

添加一个具有自动递增int值的新列,并使其成为主键:

alter table myTable add new_primary_id int primary key auto_increment first

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM