No. You NEVER loop through a resultset and run a query for each row - NEVER. That is what takes the time you are worried about. 10K records is nothing for a query to update - take less than 2 secs on my slow shared server.
$sql = "INSERT INTO new_table SELECT col1, col2, col3, col4 FROM old_table ORDER BY col2 DESC"
Make sure that you select every column except the autoinc ID column. This will be populated as the data is added, and the number sequence will be the same as your order by column.
At most you are talking about 1 Query to create the new table; 1 query, as above, to fill it; 1 query to DROP the old table; then 1 query to rename the new table. Bet you the whole thing takes less than 5 seconds to run all of them.