Ombi-app / Ombi

Want a Movie or TV Show on Plex/Emby/Jellyfin? Use Ombi!
http://ombi.io
GNU General Public License v2.0
3.64k stars 391 forks source link

Ombi slow after mysql migration #5121

Open jr-air opened 1 month ago

jr-air commented 1 month ago

Summary

Since migrating from SQLite to MySql, Ombi has not been as responsive as before and the performance decrease is extremely noticeable when using the IOS clients.

As part of trying to optimize MySql, we noticed simply adding a few more "Indexed" columns might help, and afterwards performance is as good as when using Sqlite.

Newly indexed columns: ImdbId , TvDbId , TheMovieDbId

Also, in the PlexServerContent table, these are defined as "longtext" instead of "int" as in other tables. Since we didn't want to convert the data type in this table, we created indexes using a fixed numbers of characters. Example:

CREATE INDEX idx_TvDbId ON PlexServerContent(TvDbId(10)); CREATE INDEX idx_TheMovieDbId ON PlexServerContent(TheMovieDbId(10)); CREATE INDEX idx_ImdbId ON PlexServerContent(ImdbId(12));

Ombi Version

4.43.5

What platform(s) does this occur on?

Docker

What database are you using?

MySQL

Relevant log output

Used MySql slow query logging to optimize.
jr-air commented 1 month ago

Submitted as a bug due to the significant performance hit, but could also easily be an enhancement request instead. Thanks