as your database grows there really isn’t much more you can do other than optimize the database more frequently.
I’m doing it twice a day now using crontab
#!/bin/sh
# Get the contents of the Preferences file, keep only what we need, push to a temp, then use it in the curl command
cat "/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml" | \
sed -e 's;^.* PlexOnlineToken=";;' | sed -e 's;".*$;;' | tail -1 > /tmp/plex_token.tmp
curl --request PUT http://127.0.0.1:32400/library/optimize\?async=1\&X-Plex-Token=`cat /tmp/plex_token.tmp`
rm -f /tmp/plex_token.tmp
source: Linux Tips