Updating library scans multiple times and slowly

When I update my library after adding stuff, Kodi will rescan all shares multiple times.

My movie shares will be scanned once each (3 folders), but my TV shares will be scanned atleast 3 times each. Which is a problem since I have like 10 shares.
It also scans slowly. Combining this with the multiple scans, updating the library will take atleast 10 minutes. I actually managed to repot three plants today after starting updating, and I got back inside to watch it finish scanning.

Is there a way to fix this?

It should be noted that Kodi 16 did this in seconds.

Edit: Happens on both Win10 and Ubuntu, using MySQL to share database