Stop storing Metadata in dashboard metadata_item_views database table

The database table metadata_item_views stores the view history. When you use the dashboard or the dash app to display the play history for a movie, tv show, episode etc… plex will query this table and display that information to the admin.

A design flaw of this table is that its storing various metadata fields specific to each entry, like grandparent_title, parent_index, parent_title, index and title. These fields are duplication of fields already stored in metadata_items. These metadata items can also change overtime.

Take the following example:

  1. You watch an episode on the day it actually airs. The correct metadata title for that show does not yet exist so it gets a generic TBC or something like episode 1.
  2. Once watched a watch history row is then created in metadata_item_views which contains the metadata available at that point.
  3. Then, in 24/48 hours the plex metadata cache catches up and the metadata_items table is updated with the correct information. However, metadata_item_views NEVER gets updated so it now contains the wrong old metadata in the history.

A better solution would be to always reference the metadata from metadata_items and never store it in metadata_item_views. The table metadata_item_views contains guid so it should be possible to accomplish this although I’m sure the apps would also need an update.

BTW… I cannot vote on this suggestion due to the absurd 5 vote rule plex have!!! :hot_face:

I believe this is specifically done this way because metadata items can get deleted but the history doesn’t.

I agree there should be a better way to keep that data in sync though.

I get the history rational which most likely made sense a while ago when it was initially designed.

However it seems like it needs to be reviewed, especially with the plex metadata cache taking 24/48 hours to update for the new episodes/movies etc…

If you could take it back and see what the designers think that would be great. Thanks.