|
|
|
|
|
by forrest2
1233 days ago
|
|
Or model it as a linked list and you can sidestep the limitations / complexity of some kind of numeric (or bytes / text based ordering field) ------------ playlists { id } ------------ playlist_members { id playlist_id prev_playlist_member_id (and/or next_playlist_member_id) song_id } ------------ you could then just select * from playlist_members where playlist_id = ... and sort on the client side.
you'd probably add an application limit where playlists have a max length of some kind. re-orders can be done in a fixed number of row updates and typical application queries are still possible / fast. |
|
playlists {
}-------------
and just store the ordering in an array. Some postgres drivers might start shitting the bed though at some gigantic array sizes, but a playlist probably has reasonable enough limits that you wouldn't have a big problem.