# Initializing org-roam database... taking a long time

**URL:** <https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194>\
**Category:** Troubleshooting\
**Created:** [November 8, 2021, 2:00am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194 "2021-11-08T02:00:22Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![JacksLackOfSurprise](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JacksLackOfSurprise](https://org-roam.discourse.group/u/JacksLackOfSurprise)\
**Post date:** [November 8, 2021, 2:00am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/1 "2021-11-08T02:00:22Z")

</div>

I have around 400 org files that I have been adding to my org-roam zettelkasten. I launch Doom Emacs in less than a second but the first time I load an org file in the org-roam db I get this message.

Initializing org-roam database…

and I have to wait for about 10 seconds.

Is this the expected performance or there is something wrong going on here?

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 8, 2021, 6:18am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/2 "2021-11-08T06:18:49Z")

</div>

Sounds normal to me. The next time you use Org-roam, it should be much quicker. Once database is built, it only looks at the changed files.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 8, 2021, 6:24am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/3 "2021-11-08T06:24:18Z")

</div>

If you get initialization every time you add a new file, that sounds odd.

---

<div class="post-metadata">

**Author:** ![JacksLackOfSurprise](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JacksLackOfSurprise](https://org-roam.discourse.group/u/JacksLackOfSurprise)\
**Post date:** [November 8, 2021, 8:44am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/4 "2021-11-08T08:44:37Z")

</div>

yeah I get that message every time I launch emacs for the first time.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 8, 2021, 9:10am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/5 "2021-11-08T09:10:33Z")

</div>

I don’t think that’s normal.

You should rather see something like this: “Processing modified files…done”.

Review your config. You might like to consult the Doom community. There are also a number of people here who use Doom, so maybe they can jump in. I don’t use it.

---

<div class="post-metadata">

**Author:** ![bram85](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bram85/32/863_2.png) [@bram85](https://org-roam.discourse.group/u/bram85)\
**Post date:** [November 9, 2021, 4:27pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/6 "2021-11-09T16:27:02Z")

</div>

Were your org files modified? It could be they were touched by other processes (e.g. when under version control).

---

<div class="post-metadata">

**Author:** ![telotortium](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@telotortium](https://org-roam.discourse.group/u/telotortium)\
**Post date:** [November 9, 2021, 7:46pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/7 "2021-11-09T19:46:10Z")

</div>

Same issue here. I sync my repos with Git regularly, so I wouldn’t be surprised if Git is touching a lot of these files. To try to work around this, after I complete my Git sync, I’m going to try to run [`git-restore-mtime`](https://github.com/MestreLion/git-tools#git-restore-mtime) to restore the mod times of the files to the time they were modified in Git. I’ll see whether that helps.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 9, 2021, 10:07pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/8 "2021-11-09T22:07:05Z")

</div>

Org-roam with vanilla Emacs, there is no message “Initializing org-roam database…”  
It’s coming from Doom’s specific code for the `+roam2` flag in [this line](https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/contrib/roam2.el#L53).

The Git issue @bram85 and @telotortium are discussing might still be the cause; but one possible direction may be looking at the Doom’s code around that message. You can probably test it easily with Doom’s sandbox without using `+roam2` (?)

I don’t sync my notes with Git so I can be wrong about this. Just an observation.

---

<div class="post-metadata">

**Author:** ![telotortium](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@telotortium](https://org-roam.discourse.group/u/telotortium)\
**Post date:** [November 10, 2021, 2:28am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/9 "2021-11-10T02:28:18Z")

</div>

It looks like Doom does run `org-roam-db-sync` the first time Roam is used after startup, but I think `org-roam-db-sync` should return fairly quickly if a file hasn’t been modified (which is done via hashing the file, so shouldn’t be affected by the mtime). However, it appears that reverting a file calls some hook in org-roam, which _might_ conceivably cause a slowdown.

---

<div class="post-metadata">

**Author:** ![JacksLackOfSurprise](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@JacksLackOfSurprise](https://org-roam.discourse.group/u/JacksLackOfSurprise)\
**Post date:** [November 10, 2021, 4:22am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/10 "2021-11-10T04:22:59Z")

</div>

Alright, I tried again without having the files under git and everything is significantly faster. I still see the message “Initializing org-roam database…” but for 500ms or so. So is git the culprit? Is [telotortium](https://org-roam.discourse.group/u/telotortium) solution the way to go?

---

<div class="post-metadata">

**Author:** ![lazzalazza](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@lazzalazza](https://org-roam.discourse.group/u/lazzalazza)\
**Post date:** [November 10, 2021, 9:52am UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/11 "2021-11-10T09:52:37Z")

</div>

I have the same problem with Spacemacs, my note repository is on Dropbox. Every time I start Emacs it takes ages for all my 500+ notes to be reprocessed as “modified” (they’re not)…

---

<div class="post-metadata">

**Author:** ![lazzalazza](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@lazzalazza](https://org-roam.discourse.group/u/lazzalazza)\
**Post date:** [November 21, 2021, 3:20pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/12 "2021-11-21T15:20:04Z")

</div>

Is there any news on this subject? In the meanwhile I have tried moving my notes **from Dropbox to a local folder** : the constant re-processing of files doesn’t happen in this case. It must therefore be something caused by Dropbox: could it be touching files unrequestedly?

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 21, 2021, 3:49pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/13 "2021-11-21T15:49:31Z")

</div>

I started using Dropbox with Org-roam on Windows. I don’t use Doom. No Git, either. I don’t experience any delay.

It might be worth asking the Doom community?

---

<div class="post-metadata">

**Author:** ![lazzalazza](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@lazzalazza](https://org-roam.discourse.group/u/lazzalazza)\
**Post date:** [November 21, 2021, 4:18pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/14 "2021-11-21T16:18:08Z")

</div>

Well, I forgot to tell that I don’t use Doom but Spacemacs on Macos: so the problem doesn’t seem Doom-specific. Also, as I said, when I use a local folder there is no problem at all… Thank you so much for your help, btw!

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 21, 2021, 7:34pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/15 "2021-11-21T19:34:27Z")

</div>

I see. The original issue was for Doom and Git.  
Your issue is Spacemacs and Dropbox.

We do not know if we are talking of a single same issue, or two different ones.

You may be experiencing a Spacemacs-specific issue with Dropbox then.  
I suggest you ask the Spacemacs community.

---

<div class="post-metadata">

**Author:** ![blay](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@blay](https://org-roam.discourse.group/u/blay)\
**Post date:** [December 19, 2021, 12:16pm UTC](https://org-roam.discourse.group/t/initializing-org-roam-database-taking-a-long-time/2194/16 "2021-12-19T12:16:22Z")

</div>

Did any of you solve this? I have the same issues, every time the db syncs it clears removed files and then “Processing modified files…” taking about 15 minutes to complete (~3800 files). I’m in a Dropbox synced folder and I have a git repository.

Seems like it rebuilds the entire database all the time and not just updating modified files. This happens even if I haven’t created a new file or changed any links…
