# High org-roam load time

**URL:** https://org-roam.discourse.group/t/high-org-roam-load-time/2627
**Category:** Troubleshooting
**Created:** [May 29, 2022, 6:33pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627 "2022-05-29T18:33:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![heydey](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@heydey](https://org-roam.discourse.group/u/heydey)
#### Post date: [May 29, 2022, 6:33pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/1 "2022-05-29T18:33:10Z")

</div>

Hi, I am new to emacs and org-roam and have set up basic functionalities using codes available in this and other platforms. I do find org-roam to be extremely useful in my note-taking workflow and can see its tremendous potential in organizing and retaining information.  
My workflow involves using org-roam-bibTex and org-roam. However, based on my current setup, the load time for org-roam is too high. I used benchmark-init to assess load time and this it showed that org-roam is taking more than 30 seconds to load.

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/2X/7/743c1f97034a98b385ce29cd6107b128c6150bc2.png)

Also, when I load emacs it gives me the following error message, which I think is related to the high load time:

> Blockquote Error (use-package): org-roam/:config: Query timeout error: “Query timed out”, 30

Can someone please help me troubleshoot this problem?

Here is the configuration that I am using:

```auto
;;========== Org-roam Configuration======

(use-package org-roam
  :ensure t
  :custom
  (org-roam-directory (file-truename "C:/Doc/roam"))
  (org-roam-completion-everywhere t)
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n g" . org-roam-graph)
         ("C-c n c" . org-roam-capture)
	 ("C-c n r" . org-roam-node-random)
	 (:map org-mode-map
	       ("C-c n i" . org-roam-node-insert)
	       ("C-c n o" . org-id-get-create)
	       ("C-c n t" . org-roam-tag-add)
	       ("C-c n a" . org-roam-alias-add)
	       ("C-c n m". completion-at-point)
	       ("C-c n l" . org-roam-buffer-toggle)))
  :config
  
  (org-roam-db-autosync-mode)
  (org-roam-db-autosync-enable))

  (setq org-roam-capture-templates
      '(("i" "new_ideas" plain "%?"
         :if-new (file+head "research/new_ideas/${title}.org" "#+title: ${title}\n")
         :immediate-finish t
         :unnarrowed t)
	("n" "annotations" plain "%?"
         :if-new
         (file+head "research/annotations/${title}.org" "#+title: ${title}\n")
         :immediate-finish t
         :unnarrowed t)	
	("m" "my_pub" plain "%?"
         :if-new
         (file+head "research/my_pub/${title}.org" "#+title: ${title}\n#+filetags: :article:\n")
         :immediate-finish t
         :unnarrowed t)
	
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))

;; ===== Configure Deft ========

(use-package deft
    :config
    (setq deft-directory "C:/Dey/memories"
	  deft-extensions '("txt" "tex" "org")
	  deft-recursive t
          deft-strip-summary-regexp ":PROPERTIES:\n\\(.+\n\\)+:END:\n"
          deft-use-filename-as-title t)
    :bind
    ("C-c n d" . deft))

;; ====== Configure org-roam-ui =======
(use-package org-roam-ui
  :ensure t
  :bind
  ("C-c n g" . org-roam-ui-mode))

;;========== BibTex Setup ======

;;Fine tuning BibTex mode

;;; Allow org-ref to find pdfs - basically align filenames in someway
(setq org-ref-get-pdf-filename-function #'org-ref-get-pdf-filename-helm-bibtex)

;;; Spell checking (requires the ispell software)
(add-hook 'bibtex-mode-hook 'flyspell-mode)

;;; Change fields and format
(setq bibtex-user-optional-fields '(("keywords" "Keywords to describe the entry" "")
                                      ("file" "Link to document file." ":"))
        bibtex-align-at-equal-sign t)

;; Setup BibLaTex
(setq bibtex-dialect 'biblatex)

;; Assign File Locations
(setq bib-files-directory (directory-files "G:/My Drive/Research" t "^[A-Z|a-z].+.bib$")
        pdf-files-directory "G:/My Drive/Zotero")

;; Configure Helm BibTeX to manage bibliographies, read documents and take notes

(use-package helm-bibtex
    :config
    (setq bibtex-completion-bibliography bib-files-directory
          bibtex-completion-library-path pdf-files-directory
          bibtex-completion-pdf-field "File"
          bibtex-completion-notes-path org-directory
          bibtex-completion-additional-search-fields '(keywords))
    :bind
    (("C-c n c" . helm-bibtex)))

;; configure org-ref

(require 'org-ref)
(require 'org-ref-helm)
(require 'org-ref-ivy)
(require 'org-ref-bibtex)

(setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body
      org-ref-insert-cite-function 'org-ref-cite-insert-ivy
      org-ref-insert-label-function 'org-ref-insert-label-link
      org-ref-insert-ref-function 'org-ref-insert-ref-link
      org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body)))

(define-key org-mode-map (kbd "C-c i") 'org-ref-insert-link)

;; Configure org-roam BibTex
(use-package org-roam-bibtex
    :after (org-roam helm-bibtex)
    :bind (:map org-mode-map ("C-c n b" . orb-note-actions))
    :config
    (require 'org-ref))
    (org-roam-bibtex-mode)

```

Just for context, I do not understand codes that well and the code above is mostly copied from multiple sources and somehow made to work for my workflow (as one can tell perhaps 😃 ). I will really appreciate any tips on optimizing the code above 🙂

---

<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: [May 29, 2022, 6:51pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/2 "2022-05-29T18:51:24Z")

</div>

> [@heydey](#):
>
> `(org-roam-directory (file-truename "C:/Doc/roam"))`

You are using Windows? Is this folder local or somewhere remote? If remote, that may be a dominant factor for the loading time.

Other than the loading time, is Org-roam working?

How may nodes do you have? If it’s more than 10K, it might be just normal (but not sure).

> [@heydey](#):
>
> ```auto
> (org-roam-db-autosync-mode)
> (org-roam-db-autosync-enable)
> 
> ```

You only need to do the first one. It includes enable. I don’t think it’s likely part of the loading problem, though.

---

<div class="post-metadata">

### Author: ![heydey](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@heydey](https://org-roam.discourse.group/u/heydey)
#### Post date: [May 29, 2022, 7:16pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/3 "2022-05-29T19:16:35Z")

</div>

Thanks @nobiot for the quick revert. Taking that second line out fixed the load-time problem.

I have a related question about storing org-roam files on my PC (I use windows) vs remotely.

I am just starting to use org-roam and do not have a lot of files yet. I am planning to move from a PC to a Mac later this year and was wondering if my nodes would be affected by the change. For examples, would the links between nodes still work if I move my org-roam folder from a PC to a Mac? Is storing files remotely e.g. on Google Drive a more sustainable solution for situations like these?

Thanks!

---

<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: [May 29, 2022, 8:20pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/4 "2022-05-29T20:20:01Z")

</div>

> [@heydey](#):
>
> Taking that second line out fixed the load-time problem.

Great. This is good news. I can’t explain why, though, and am a bit puzzled. But the result is great. Apologies if I mislead you.

> [@heydey](#):
>
> I am planning to move from a PC to a Mac later this year and was wondering if my nodes would be affected by the change.

It should not. I often move files between my Windows and Linux machines. I used to use Dropbox to sync files in Org-roam directory, too. Either way, I have had no issue. That’s the benefit of text files. I also used macOS in the past; I copied and pasted all the files to Windows and Linux – no issue.

Google Drive can be used to sync between machines. I just happen have used Dropbox in the past. These cloud storage applications should be just an additional convenience, and should not affect your use of Emacs and Org-roam.

Technically, between Windows and other OS, you may experience the difference about [line ending style](https://www.emacswiki.org/emacs/EndOfLineTips) (typically, Emacs on Mac or Linux may display text files created in Windows with the end of the line as “^M”) but this should not affect the content of the notes and Org-roam.

---

<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: [May 29, 2022, 8:23pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/5 "2022-05-29T20:23:09Z")

</div>

By “remote”, I meant files placed in a file server in the network you have access to, not Google Drive – it stores files locally and have a duplicates on the cloud storage. So for the purpose of Emacs, the files are accessed locally.

You have “TRAMP” in your config, so I thought you store your org-roam files in some file server – this can be slow…

---

<div class="post-metadata">

### Author: ![heydey](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@heydey](https://org-roam.discourse.group/u/heydey)
#### Post date: [May 29, 2022, 8:48pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/6 "2022-05-29T20:48:15Z")

</div>

> [@nobiot](#):
>
> You have “TRAMP” in your config, so I thought you store your org-roam files in some file server – this can be slow…

I see. Tramp is in fact the next item that is slowing the load time. I did not install it myself, but I do use OneDrive to back my files on the cloud. So maybe its picking that up somehow?

---

<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: [May 29, 2022, 9:17pm UTC](https://org-roam.discourse.group/t/high-org-roam-load-time/2627/7 "2022-05-29T21:17:47Z")

</div>

Emacs does not do anything (usually) unless you tell it to. Maybe your bibtex files in drive G is related but i can’t tell. I don’t think I use TRAMP.
