In my case, it was photolibraryd and not photoanalysisd that was hogging CPU and also causing massive HD churn, but I'd like to provide an answer here that worked for me in stopping photolibraryd, because (1) I think these tips will work for stopping photoanalysisd too, (2) this page is one of the top Google results for people searching for info about photolibraryd, and (3) none of the advice on this page (as of 2021-07-01) worked for me in stopping photolibraryd.
First, I was initially experiencing massive disk churn, particularly disk-writing not reading. This started when I moved the Photos library from one user account to another on the computer. This problem was partially due to the fact that my new account did not own the files inside the Photos Library bundle. I had to open the bundle (go to ~/Pictures/Photos Library.photoslibrary and right-click it, then choose "Show Package Contents"), Get Info on each subfolder (database/, external/, originals/, etc.), and under the Sharing & Permissions section add my new user account, set its privileges to "Read & Write", and then click the ellipsis-in-a-circle button at the bottom and choose "Apply to enclosed items…". I had previously given myself Read & Write privileges for the overall Photos Library bundle, but this was not enough.
Giving myself R&W access to all the contents stopped the disk-writing churn and the errors that were showing up in Console.app from photolibraryd, however it still continued to dump tons of non-error messages into Console and was reading continuously from the HD at 15MB/s for hours despite the fact that I don't have enough photos to occupy it for more than a couple minutes at that speed.
At this point, the advice here from mbackschat on 2020-01-03 worked instead, which is to rename the folder ~/Pictures/Photos Library.photoslibrary/database to something else (for example, to database.xxx). This confounds photolibraryd so that it stops thrashing the computer. Note that launching Photos after doing this will initiate a "Restoring…" process that recreates database/, so you will have to do this after each time you use Photos.