Mysql Incrementing variable performance

前端 未结 1 1496
心在旅途
心在旅途 2021-01-25 19:01

I has looking for a way to sort items in a mysql table. Here a simplified version of the table

sqlfiddle => http://sqlfiddle.com/#!2/78521b/3/0

CREATE T         


        
1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-25 19:25

    Don't store sort in the table; store it in a separate table. Furthermore, don't UPDATE that table, recreate it. Further-furthermore, use the following to avoid any downtime:

    CREATE TABLE New SELECT ... -- generate new sort order
    RENAME TABLE Sort TO Old, New To Sort;
    DROP TABLE Old; 
    

    0 讨论(0)
提交回复
热议问题