Just a bit more info, core will rescan the ENTIRE blockchain from the beginning to the end when you do this. On a slower PC or one with a slower drive / other limited resources with it can take a REALLY long time. As in HOURS. Do not stop the process, it will just have be started again. There are ways to shorten it a bit but for the most part just do it and go to bed. When you wake up in the morning it will be done.
If you are running a fast newer machine with a lot of RAM and an m.2 nvme it's a different story, but don't get frustiated while it's rescanning.
-Dave
It also helps to
renice(1) the Bitcoin Core process if you have other things running in the background, so that it gets priority CPU and I/O access. Just make sure you don't make it realtime because then you could make the entire system unstable.
Generally, this will not help when there Core is the only process running, and it is only expected to improve the performance to as if it was the only program running on the system.
In Windows you can change the process priority with task manager, and it accomplishes the same thing.