Spotlight is slow in Catalina

This isn't your standard "spotlight is slow" post due to things taking 5 seconds to react. The clue that something is strange is that on Terminal, if I type "mdfind name-of-file" it works in <1 second. If I use Spotlight, it takes 5 seconds. This is using the name of the file, without the extension. I tried it on both images and text files.

So, this isn't an indexing questioning, because obviously the index works on the command line. This isn't a "Spotlight Suggestions" question, because I tried turning that off, as well as location services.

The only thing I can think of is that Spotlight is slow in organizing and presenting the data that mdfind provides. But how do I make it faster?


Solution 1:

Short Answer:

This is a known issue with users complaining about Spotlight AFTER moving to Catalina. So was working correctly PRE-Catalina, WASN'T working correctly POST-Catalina upgrade. Apple Software Engineers made some material change to the operation of Spotlight in Catalina which introduced the fault, which must be resolved by those same engineers by way of a future patch.

Longer Answer:

Unlike mdfind which directly queries the metadata store, a query made in Spotlight is proxied through the "Spotlight Engine" which appears to be the corespotlightd I see in Activity Monitor.

Indeed, Spotlight does things mdfind doesn't, such as calculations and searching on the web- which means Spotlight can have a dependency on your Internet connection! mdfind only queries the local metadata store directly and returns the results through stdin.

You're far from the only one suffering from slow performance in Spotlight. Loads of Catalina users are screaming for Apple to fix the problem. First complaint reported 15 Oct 2019 (week after Catalina release) and most recent complaint in link is 08 Jan 2020. The link reveals users complaining of high CPU (amongst other things) when using Spotlight which strongly indicates a bug in the process(es) responsible for proxying the query & returning results.

Therefore, the Spotlight performance issue appears to be a fault software engineers at Apple will ultimately have to resolve. This analysis is bolstered by the observation of these users who noted the fault was first observed after the Catalina upgrade.

Diagnostics

I'm not suffering this issue on my Macbook (2018 w/ 32GB RAM & 4TB Storage), but offer some useful tips for investigating it by those who are. This is not to say you'll be able to resolve the fault, but at least understand where/how things are breaking and (hopefully) tell Apple!:

  • Disable Internet Searches & Location Services in Spotlight to unhook the Internet dependency which could be affecting speed when testing:

  • Use Activity Monitor Diagnostics to analyze Spotlight process corespotlightd:

Activity Monitor Screen 1

Activity Monitor Screen 2

The following granular diagnostic output is produced: PLEASE NOTE: The file md_stores.txt is just where my cursor was resting when I took the screenshot. Review all the diagnostic files.

Output of Diagnostics

  • Repeat process for and process Spotlight and review output for clues...

If you find how it's broken, TELL APPLE!! ;-)

Solution 2:

This is not an answer, but rather an addendum to @philipkd's initial question to further demonstrate the weird behavior of Spotlight on Catalina.

I recorded a video demonstrating https://www.youtube.com/watch?v=B3dwqbIPFWo

  • Search for the same file, Spotlight (+Space) takes 5 seconds or more.
  • However, using Finder search (++Space) which searches the same Spotlight index built by Spotlight, it is almost instantaneous.
  • A force re-indexing using sudo mdutil -E / does not solve the problem either.

Solution 3:

Setting it like this worked for me to make it almost as fast as before.

spotlight setting