0

I have a table of over 5000 users and each has a time. What need to to is every time the user completes a race I need to reorder my 'position' table. My process would be to delete the position table - which is joined to the main 'users' table with the id and then run a query to loop through and insert by order.

A few questions

  • with this number of users is there going to be a performance issue?
  • what is the best way to run the query? Should I just pull them out into an array, order them and then do a loop/insert?

If there is a better way I would love to hear it.

LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
  • No I think you should probably have a serious think about your database design. Also this is a bit thin on real information. Try pasting the database schema for the tables involved. Maybe some existing code etc. – RiggsFolly Aug 19 '15 at 08:27
  • 3
    Anyway, why not just update each racers position and then when you retrieve the data add and ORDER BY clause to the query to return them in the finishing position order. I assume you are not keeping any history of past races?? – RiggsFolly Aug 19 '15 at 08:29
  • possible duplicate of [mysql sorting and ranking statement](http://stackoverflow.com/questions/7056895/mysql-sorting-and-ranking-statement) – Raptor Aug 19 '15 at 08:34

0 Answers0