17

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?

  • you should look for an example that takes more than 1 sec in mdfind. Maybe the 4 seconds is just the difference in initiation times. If so it is not that critical. I'd be concerned though if it scaled up when mdfind takes longer times. – jmh Jan 18 at 2:02
  • Repair the disk using Disk Utility's First Aid OR fsck from single user mode & then re-index spotlight. Spotlight's service references pointers differently than the terminal. Your Terminal's shell is path specific thats why mdfind might yield faster results. – CJ Dana Jan 18 at 9:24
  • @CJDana Thanks for the tip. I went through all the steps, and the issue is still there. Fast mdfind, slow Spotlight. – philipkd Jan 18 at 18:34
  • 1
    I have had the same issue. Searching apps through spotlight works instantly (thank heavens; otherwise I'd defenestrate my macbook) but PDFs, filenames, etc. is dead slow. I've marked my hard drive as private, then slowly added back places to search. Slowed down when I added ~/Library and /Library, as well as Photos, and System files. Not sure if this was just an artifact of me adding those places last. – Ashton Wiersdorf Jan 29 at 4:33
  • 1
    @philipkd I posted the link to your question on discussions.apple.com 5 days ago to drive the troubleshooting traffic here for the issue so we could hear from folks other than myself, but no luck. Anyhoo, I tried bud- T – F1Linux Feb 4 at 12:25
11
+50

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!:

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!! ;-)

| improve this answer | |
  • 1
    mds_stores's physical footprint (peak) is 1.8G; mds, Spotlight, and corespotlightd all are <55MB – philipkd Jan 30 at 8:30
  • 1
    From a comparative analysis perspective- comparing the correct mdfind with the incorrect Spotlight- we can exclude indexing as a fault as you noted; both query same indexed pile of metadata. mdfindcommand works correctly independently of Spotlight. Indeed, the material way in which they vary is the query is proxied through at least 1- possibly 2- processes: Spotlight and/or corespotlightd. Folks in my link are specifically complaining about Spotlight post Catalina upgrade. I strongly suspect Apple's made a material change to these processes that's causing this fault. – F1Linux Jan 30 at 9:00
  • 1
    Having the same issue here, hopefully Apple fixes this thing... – Shuhao Cao Apr 20 at 7:35
  • Could you clarify if this answer is a solution or just documentation, please? – 2540625 Jun 20 at 1:03
2

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

spotlight setting

| improve this answer | |
  • Interesting. I would have normally reinstalled MacOS, and then tested to see if the issue persisted. – Melvin Jefferson May 3 at 13:26
  • I unticked all but apps, calculator, conversion, and system prefs. Still slow. – 2540625 Jun 20 at 1:06
1

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.
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .