Instead of Position
field you can use a field as LastSongId
where you can add the SongId
of the previous song in the play list.
So when you want to change you order you only need to update only twothree rows.
The first row: Your song with new order
The second row / the third row: The song before and after your your changed position song
Your new schema:
+------+------------+----------+
|SongId| PlaylistId |LastSongId|
+------+------------+----------+
| 1 | 10 | NULL |
| 2 | 10 | 1 |
| 3 | 10 | 2 |
| 5 | 10 | 3 |
| 6 | 11 | NULL |
+------+------------+----------+
If you change the SongId 3 as position 1, you'll have:
+------+------------+----------+
|SongId| PlaylistId |LastSongId|
+------+------------+----------+
| 1 | 10 | 3 |
| 2 | 10 | 1 |
| 3 | 10 | NULL |
| 5 | 10 | 2 |
| 6 | 11 | NULL |
+------+------------+----------+