Set default priority of mdworker processes
See https://apple.stackexchange.com/a/265751/263848.

Spotlight indexes in the background and should not impact performance significantly. If you are experiencing serious issues, you may have a bigger issue at hand.



Are you sure it doesn't occur when spotlight indexing is off?



I would suggest trying basic troubleshooting steps. Maybe a reinstall.