⬅︎ Back to Optimization of getting random rows out of a PostgreSQL in Django
No, you would replace the 3 with 1. That is the highest position value in the sequence 1,3,2. Not the *last* value in position, the *highest*.
I dont think that would work, ie. we got 1,2,3,4. We delete 2 1,3,4 are left and we are missing 2. Flowing ur advice i can update last value (4) and get 1,3,2. Now, I delete 1. 3,2 are left and updating last value wont give us a correct sequence
Comment
No, you would replace the 3 with 1. That is the highest position value in the sequence 1,3,2. Not the *last* value in position, the *highest*.
Parent comment
I dont think that would work, ie. we got 1,2,3,4. We delete 2 1,3,4 are left and we are missing 2. Flowing ur advice i can update last value (4) and get 1,3,2. Now, I delete 1. 3,2 are left and updating last value wont give us a correct sequence