Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
v18 MySQL slow requests on tv show seasons
#31
For anyone getting as frustrated as me when upgrading to 19.1 with the slow kodi season_view replace the view query with this query and you will have < 0.5s query time with mysql 5.7 without cache enabled. Not sure if it will work with kodi 18, i jumped from 17 to 19 in one go.

https://paste.kodi.tv/iyakeheyob

You also need to add another index;
sql:
ALTER TABLE `episode` ADD INDEX( `c12`, `idShow`);
Reply
#32
I tried this in 18.  It mostly works.  The seasons view is now lightning fast.  The problem is that it now always shows a Season -1 as the first season, which appears to be the "all seasons" view which I have turned off via settings.  And also every show displays the Specials season even if there are no Specials.

The other problem for me is that I'm using Kodi's default SQLite, not MySQL, and using Alter Table to create an index is only supported in MySQL.  And I don't know the syntax to create the index for SQLite.  Not sure if not having the index will hurt me in the long run.

But!  The Season view is now so fast!  Thanks so much @blodan !  Now just have to decide if I can live with the Season -1s and Specials.
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#33
(2021-06-09, 00:33)fnord12 Wrote: I tried this in 18.  It mostly works.  The seasons view is now lightning fast.  The problem is that it now always shows a Season -1 as the first season, which appears to be the "all seasons" view which I have turned off via settings.  And also every show displays the Specials season even if there are no Specials.

The other problem for me is that I'm using Kodi's default SQLite, not MySQL, and using Alter Table to create an index is only supported in MySQL.  And I don't know the syntax to create the index for SQLite.  Not sure if not having the index will hurt me in the long run.

But!  The Season view is now so fast!  Thanks so much @blodan !  Now just have to decide if I can live with the Season -1s and Specials.
Thats a easy fix, I noticed it myself, just add this as the last row in the query and it will work as the original query and still being fast;
Quote:HAVING episodes > 0 
Reply
#34
SQLite didn't allow HAVING but changing it to WHERE did the trick.  Now it's still super-fast but without the extraneous seasons!  Thanks again!

I also found that there was a problem with the Watched checkmarks.  It seems that if you'd watched all episodes in a season but also watched an episode more than once, the Watched checkmark was not appearing.  Changing your query for the playcount from a SUM to a COUNT seems to have fixed the problem (which is a little weird but I'm not complaining; I'll update if that causes some other problem).

So, for me (in v18 and with SQLite ) here's the final statement that worked for me:

https://paste.kodi.tv/ibovoyejer

Thanks again @blodan ! This solved a major annoyance for me (and hopefully a lot of others that have run into this).
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#35
any chance the sql can be put somewhere else?  the links above seem to be expired.  I am facing the same problem.
Reply
#36
@fnord12 FYI, Kodi's paste service retains pastes for some 60 days only. ^^
Reply
#37
@kossatzd

Sorry for the delay in responding.  I got an error message when trying to post SQL code directly in the forum, so i've placed it on my github page:

https://github.com/fnord12/season_view/blob/main/sql

Let me know if I can help further.
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#38
Using your query, I am getting:

Operation failed: There was an error while applying the SQL script to the database: 
ERROR 1054: Unknown column 'episodes' in 'where clause'

It's weird because it is defined in the code on github.  Do you have a copy of your seasons_view you could share?
Reply
#39
Query is not working. I fiddled out the errors of „spaces“ but it still throws an error.

I had fixed the database this way on MySQL but now I don’t know anymore how the syntax was.

I have a lot of movies and TVShows (looks like more others in this thread have) so my „problem“ is quite extreme
Reply
#40
Blodan's original code (see thread above) used "HAVING episodes" instead of "WHERE episodes" so if you are using MYSQL instead of SQLite you may try that (although as you point out, the error message you're getting doesn't fit).  My code works on Kodi 18 / MyVideos116.db with SQLite.
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#41
The code posted by you an blodan in the pastebin is gone since pastebin has only some days retention.
The code on github does not work (even when fixing the obvious bugs with missing spaces).

I am using mariaDB btw

I can see when querying the View via HeidiSQL it takes forever which is the result of over 1000 series with multiple Episodes. Some even with 100 and more. I think there is a possibility to make the query a lot faster.
Same for tvshowview which is referenced in it.

My machine is not the problem (Xeon 8core with 64gb RAM and System on SSD)

I am not capable enough in SQL to see how to speed up the views
Reply
#42
@blodan can you provide your sql statement again?
Reply
#43
(2022-04-02, 22:13)SakuraKira Wrote: can you provide your sql statement again?

Doubtful... Mr blodan last visited the Kodi forum on 18-07-2021.
Reply

Logout Mark Read Team Forum Stats Members Help
MySQL slow requests on tv show seasons0