2 Votes Vote

Generate (i.e. write) a row number index column in MySQL

Posted by topdog 228 days ago Questions| row row number number All

I need a row number index in my MySQL tables, based on ORDERing on a table column. I know about the

SELECT ... @curRow := @curRow + 1 AS row_number ...

trick which will output the row number; what I actually want, however, is for that row number to be written into the table as a persistent column. Performance is a critical issue. What is the best way of accomplishing this?

Originally asked by: Maximilian on Stack Overflow

Discuss Bury


Who Voted for this Question