I struggled to find a resource that could help me solve my problem, and it seems like a rather difficult problem to wrap my head around.
Let's say I have a table in the database (100 records) with a whole field of the sequence (which is incremental). Now I have the functionality to reorder the list in which the user can drag an element from the bottom of the word to the middle (for example, a sequence of 100 → 50).
At the moment, I have determined that the record sequence will be 50, and each record will be updated with a subsequent sequence of 1+. (e.g. 50 becomes 51, 51 equals 52), so on ...
This is ineffective for me, since it has to update 50 records in order to change the sequence and may take some time, especially if the table grows in size.
Is there any effective reordering method that does not require updating each record?
source
share