Created attachment 103386 [details] root-tag.jpg apears in multiple stages, copying a part of the database each time. Certainly the database get more and more slow this way.
It's not the first time.
This was fixed together with many changes in the mysql database in version 5. From the screenshot it looks like you are using version 4 still. If your distribution packages do not allow you to upgrade to 5, there is an appimage available which you can download, make it executable and then just run it, see https://www.digikam.org/download ("official bundle"). Before you migrate, create backups and if you face problems, write to the user mailing list. *** This bug has been marked as a duplicate of bug 283323 ***
Fixed with #283323