Clean DB issues:
1) It is on the main thread, so you can't do anything else etc.
2) It is slow, so "clean" is not the best way to empty the DB (actually removing the DB from the server would be quicker, let Kodi make a new one)
But quite so slow....?
(2017-02-21, 20:39)Rusendusen Wrote: During the process a temporary table tmp_delartists gets created and from this point on it gets stuck.
Quote:26089 Query CREATE TEMPORARY TABLE tmp_delartists (idArtist integer) CHARACTER SET utf8 COLLATE utf
_general_ci
26089 Query INSERT INTO tmp_delartists select idArtist from song_artist
170221 11:11:10 26089 Query INSERT INTO tmp_delartists select idArtist from album_artist
170221 11:11:11 26089 Query INSERT INTO tmp_delartists VALUES(1)
26089 Query delete from artist where idArtist not in (select idArtist from tmp_delartists)
170221 11:11:14 26089 Query DELETE FROM album_artist WHERE album_artist.idArtist = old.idArtist
26089 Query DELETE FROM song_artist WHERE song_artist.idArtist = old.idArtist
26089 Query DELETE FROM discography WHERE discography.idArtist = old.idArtist
26089 Query DELETE FROM art WHERE media_id=old.idArtist AND media_type='artist'
The bold line indicates the, from my view, beginning of the problem. After that query there are 4 queries following for each artist, I guess: DELETE FROM album_artist, song_artist, discography, and art. These individual sets of 4 queries for each artist takes from a minute up to multiple hours each :-(
Wish you had shown more of this server log, or did it stop there? Testing was MySQL not MariaDB?
The slowness of deleting from album_artist, song_artist, discography and art for each artist is confounding me. These cascade from the triggers fired after artist is deleted, so I expect them to happen, but they should be super fast because the artist cleanup happens after all the song_artist and album_artist tables have already been cleared. There is even a code comment "Create temp table to avoid 1442 trigger hell on mysql".
With a lot of artists "where idArtist not in (select idArtist from tmp_delartists)" could be slow, but not the triggered deletes.
At a loss for now, but wanting you to know I have thought about it.