Did you use an early version of the database debloating script?
(the one which handled the egregious ballooning of DB file size last year)
The early version had a bug which missed to define the primary index column of the repaired table. This can cause the issue you’re experiencing.
See Plex not removing old .db files for the new versions of the debloat script. You need to re-apply it.