Hey! I keep getting very slow startup and repeated scanning of nodes every time I open up a node. Something seems to be up with my database. Any idea how to resolve this?
I’m not sure on which version I am, since org-roam-version returns funcall-interactively: Search failed: "\\(?:;; Version: \\([^z-a]*?$\\)\\)". But the folder name is ~/.emacs.d/elpa/org-roam-20250701.528/.
I got the below warnings when updating the package:
■ Warning (native-compiler): org-roam.el:217:29: Warning: the function ‘org-roam-descendant-of-p’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:88:19: Warning: the function ‘org-roam-list-files’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:60:43: Warning: the function ‘org-roam-node-point’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:55:23: Warning: the function ‘org-roam-node-file’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:54:35: Warning: the function ‘org-roam-node-create’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:54:16: Warning: the function ‘org-roam-populate’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:42:7: Warning: the function ‘org-roam-up-heading-or-point-min’ is not known to be defined.
■ Warning (native-compiler): org-roam-id.el:40:22: Warning: the function ‘org-roam-db-node-p’ is not known to be defined.
■ Warning (native-compiler): org-pdftools.el:446:19: Warning: the function ‘org-export-file-uri’ is not known to be defined.
■ Warning (native-compiler): org-pdftools.el:138:74: Warning: the function ‘equalp’ is not known to be defined.
I’ve manually removed the org-roam folder mentioned above and restarted emacs to see if there was an issue with the native compiled cache or something, but I get the same issue. It triggers when I hit org-roam-dailies-goto-today or just open up any org-mode file for the first time.
Thanks! I’ve done package-recompile-all and then (sqlite-available-p) returns t. I’ve then deleted ~/org/org-roam.db (my org-roam-directory is a different folder though, so this may be an older file!).
(setq org-roam-db-update-on-save nil) ;; I've also tried t
(org-roam-db-autosync-mode)
I’m not seeing a new database file pop up now. When I manually org-roam-db-sync I get the message (not warning!) finalizer failed: (wrong-type-argument sqlitep nil).
So I’m guessing it’s slow because it never manages to write the db and tries to rebuild it every time, only to fail… But e.g. org-roam-node-find does work.
Do not worry about “Finalizer failed” message for now. We collectively know what it is, and it is unlikely related to 1 or 2 (I could be wrong but it won’t be the first thing to look into).
Has either of your main issues (1 or 2) behave any differently?
Where is your database? Do you know how to find it?
Thanks! I don’t care so much about the slow startup because I use emacs as a daemon. It’s really the fact that every time I open a node or file with nodes or C-z to add a note to drawer, it needs to Clear and Process files and this takes so long that’s it’s disruptive.
Good point about the database, I was using fd “org-roam.db” but this didn’t find it, because I forgot to pass the -H flag . Doing C-h v org-roam-db-location showed me ~/.emacs.d/elpa/org-roam-20250701.528/org-roam.db.el and .elc so I’ve deleted that file as well as the ~/.emacs.d/eln-cache/ directory. I have now deleted all the org-roam-db.el and org-roam.db files I could find and have triggered re-creating the database (whew it’s a bit slow!). Fingers crossed that this will fix the issue! I’ll resolve this if it does.
This and .elc files are not your database… They are part of the program source. The db is saved as the filename specified by variable org-roam-db-location. The extension is .db by default.
How exactly do you “open a node”? And what is C-z map to? By default C-z is not mapped to any org-file. Are you using Doom or something?
When you use Emacs as a demon, does it keep the session? Or a new session is created every time? (If you don’t run emacs-server, this may be the case). If latter, it is possible that every time you open a file from your terminal emulator (with emacs -nw FILE.org as an example) your org-roam may get initialized — hence, your Emacs on daemon may scan all files in your org-roam repository.
This is my speculation. You need to share or think about how exactly you initialize Emacs, org-roam, and “open” your org-roam node.
I use Emacs as an app (with GUI) without daemon, so I keep a single Emacs session for the whole day. My Emacs does not scan all the org-roam files every time I visit one of them via org-roam-node-find or find-file commands.
Ah yeah that was dumb. Deleted the whole package so my use-package will re-install. The next restart of emacs re-created the ~/.emacs.d/org-roam.db file. However, after building the database this still triggers (on creating a new node, opening a node, or anything to do with nodes) those “Processing modified files…50%” churns… Will try to delete the db once more and see what happens…
Hmm it’s still behaving weird. Now when I open any org-roam file it shows the same warnings as before, but after indexing these files are now no longer delayed. But somehow it has not scanned all my nodes, and only half of my notes show up when I org-roam-node-find. When I open up one of the notes that refer to these notes that don’t show up, it re-indexes again and then these also show up and the system is fast. But after several hours it starts all over even though I’m still in the same emacs session… This is really frustrating my daily use .
Do you sync your note files with an external server? I suspect the answer is yes, and if this is the case, please make sure the sync does not change the file’s attributes — e.g. modified date. If file attributes get updated, I believe Org-roam treats that as a change to the file for database update.
Yes, I sync the files via owncloud for backup. I don’t think it changes anything about the files but I’ll disable the sync for a while to see if that improves things.
I open files either with e.g. org-roam-dailies-find-today (which I have bound to C-c C-n n) but also just opening my regular todo files or org-files that contain ID’s trigger the change, i.e. with find-file C-x C-f.
I have been using org-roam for at least 4 years, from before v2. I’ve never had to deal with this kind of cache issue!
I have no idea what all these encryptions do, but org-roam uses SHA1 hash of the content of the current buffer to check if it has been changed from the state when the file was saved (SHA1 hash is saved along the absolute file name). If any part of your system (sync or file encryption) changes the file’s hash (this may include file’s attributes such as last modified time stamp), then Org-roam will see the file as changed.
I just went back through my daily notes and I was experiencing this org-roam slowness before I encrypted my ~/org folder. I’ve experienced a more reasonable amount of slowness recently, but it’s still not anywhere close to the speed I had come to expect. I think the improvement may be just because I’ve been running long sessions and most of the notes were open already as buffers and at least that was now fast. I’ve moved the database location to the same folder in the hopes that it getting the same encryption treatment would help somehow.
Recently I also noticed that when I startup, not all the nodes were listed. When I opened up the today daily note, and from there try to insert a link (org-roam-node-insert) or switch to a node (org-roam-node-find) that I know exist, some of them were not shown. After opening the note up manually with C-x C-f everything in the folder shows up again and starts to work normally. Weirdly this now no longer reproduce when I restart my emacsclient, even though I have not changed my settings.
To reproduce what’s happening now, I’ve restarted my emacsclient and looked at it from scratch:
I’ve now configured org-roam to defer loading until I open an org-node. This means that opening a regular org-file is now fast (basically instant) again initially. However, when I org-roam-dailies-find-today and roam initializes (slow, same messages as in first post), opening up regular org files triggers the same slow process as well. In contrast to what I describe above prior to my restart, however, now processing modified/deleted files is pretty fast and it seems workable but still not as fast as it used to be.
Sorry for the hard-to-reproduce issue, I’m very confused by this.
One thing you can try is determine if the problem is the database or is updating the database.
Open the database with SQLIte and look for a file in the DB that you have trouble with (adjust to the location of your database). Note that filenames are wrapped between double quotes (that is an emacsql thing).