I'm trying to figure out what the best approach will be for me a social music app I'm creating database wise.
I'm struggling with the best design pattern for a live feed data table. Imagine a table that has information about currently playing playlist by users. In order to keep performance as high as possible I would like to clean up the table as soon as a playlist is done playing. This is determined by a heartbeat, if a user is still listening, a timestamp will be updated every minute or so.
I also would like to use this data in a user profile so you would be able to see the last played playlists.
Some options I have thought about:
- Run an azure function every x minutes and copy obsolete/old rows into an archive table and delete the row from the main live feed table? I will use this archive table when requesting last played playlists.
- Create an archive table and automatically synchronize every CRUD of the main table. Delete obsolete rows by an Azure Function run every x amount of time? I will use this archive table when requesting last played playlists.
- Just keep one table? I'm expecting problems with performance after some time.
Aucun commentaire:
Enregistrer un commentaire