edit: PR has been merged. The official manual has correct examples.
A couple of comments for your usage:
You can also use the “exclusion” to avoid exporting your private files (for this, you should probably look at your export engine – I don’t publish my notes. I hope others can jump in to comment; there are many people who use Hugo, etc.
If you were to use dir-locals.el, be careful with your subdirectory. Apologies if this is stating the obvious for you – you would like to avoid the situation where your public directory contains your private directory as a subdirectory – the public instance would not exclude the private instance automatically
“Remember to run org-roam-db-sync from a file within that directory” as the manual instructs – dir-locals.el changes the setting automatically, but this does not trigger DB creation/update automatically. I’d avoid creating many small instances for this reason; you’d need to somehow remember to do this for every instance…