Query Performance and Crash

I made a query with a search after two properties which I have includet in several pages. With 20 results it get very slow and with 23 items in the table logseq freez.

Same here. On {{ query (and (property1) (property2))}} RAM-Usage increases slowly about 3GB, proc usage grows to 100% on all four cores until Logseq crashes. Updating AppImage from 0.8.16 to 0.9.1 without any change in this behaviour. Started AppImage in terminal, only suspiscous message was

x-mode@p5:~/AppIMages$ ./Logseq-linux-x64-0.9.1.appimage
(rsapi) init loggers
21:57:31.031 › Logseq App(0.9.1) Starting…
21:57:31.048 › restore proxy settings {:type “system”}
21:57:31.050 › set proxy to {:type “system”}
[254609:0408/215736.373857:ERROR:nss_util.cc(349)] After loading Root Certs, loaded==false: NSS error code: -8018

My system:

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-69-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6820HQ CPU @ 2.70GHz
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530

Been digging deeper into this. The query {{ query (and (property1) (property2))}} works flawless with little number of results. But already with 17 results, the resources of the computer are massively strained, it takes a perceived eternity until the 17 results are displayed. When they are displayed and I edit the display options, it takes up to 20 seconds until pressing a button has an effect. At the same time, the processor is intensely stressed and the fan spins at high speed. We are talking about an i7 processor and only 17 results while the graph contains only 1,8mb data! More than ~20 results regularly cause Logseq to freeze with only white space in application window on my system.

1 Like

Tests on another machine with a different proc, RAM, OS version and Logseq-linux-x64-0.8.16.AppImage produce exactly the same behaviour.

Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.8
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.4.0-146-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-3320M CPU @ 2.60GHz
Memory: 15,3 GiB

Back on i7 testing with latest Logseq-linux-x64-0.9.2.appimage, same behaviour.

Working hard on {{query (and (property 1) (property 2))}}

Until crash

there are several issues on github too. i think Performance problems in queries · Issue #5213 · logseq/logseq · GitHub is the better one (there are a few more. hard to pick one actually, most of them have some discussion going on.) you might want to subscribe to those issues.

a workaround for the time being: example of efficient multi-property advanced query by cpackard · Pull Request #88 · logseq/docs · GitHub

2 Likes

Thank you so much for pointing me there. Actually advanced query

#+BEGIN_QUERY
{
:query [
:find (pull ?p [*])
:where
[?p :block/properties ?pr]
[(get ?pr :property1) ?t1]
[(get ?pr :property2) ?t2]
[(= “foo” ?t1)]
[(= “bla” ?t2)]
]
}
#+END_QUERY

delivers 47 results in no time. Seems like I have to look deeper into advanced queries.

1 Like

I wish Logseq had a prevention mechanism to stop heavy queries before they freeze or crash Logseq app. Or some treshold for returned results. Thanks for pointing out the performance difference between simple and advanced query!