You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A main blame of query issue is actually about clause order of queries.
We should setup a FAQ on the forum https://discuss.logseq.com/c/faq/6 to help saving the communication cost of the process. Then make it to the document.
The clauses are executed sequentially.
If you mention a binding in a clause that is not mentioned at all in the previous section,
it will do a full-text search, which will be very slow
So you should try to use up the input in the first order, and keep the conditions small
To narrow the scope step by step
For example, if the input is ?cn:
[?b :block/page ?p] ;; This clause has no constraints, so don't put it here
[?cd :block/name ?cn]
[?b :block/path-refs ?cd]
(not [?b :block/page ?cd])
should be changed to
[?cd :block/name ?cn]
[?b :block/path-refs ?cd]
(not [?b :block/page ?cd])
[?b :block/page ?p] ;; wait for the previous clause to narrow down, then execute the unqualified clause
The text was updated successfully, but these errors were encountered:
A main blame of query issue is actually about clause order of queries.
We should setup a FAQ on the forum https://discuss.logseq.com/c/faq/6 to help saving the communication cost of the process. Then make it to the document.
References:
https://docs.logseq.com/#/page/advanced%20queries
https://docs.datomic.com/on-prem/query/query-executing.html#clause-order
https://github.com/logseq/logseq/blob/d0af76d513407f660946d9c957cf2786f430e2a2/deps/db/src/logseq/db/rules.cljc#L26-L62
The clauses are executed sequentially.
If you mention a binding in a clause that is not mentioned at all in the previous section,
it will do a full-text search, which will be very slow
So you should try to use up the input in the first order, and keep the conditions small
To narrow the scope step by step
For example, if the input is ?cn:
[?b :block/page ?p] ;; This clause has no constraints, so don't put it here
[?cd :block/name ?cn]
[?b :block/path-refs ?cd]
(not [?b :block/page ?cd])
should be changed to
[?cd :block/name ?cn]
[?b :block/path-refs ?cd]
(not [?b :block/page ?cd])
[?b :block/page ?p] ;; wait for the previous clause to narrow down, then execute the unqualified clause
The text was updated successfully, but these errors were encountered: