This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-30
Channels
- # aleph (2)
- # announcements (4)
- # babashka (3)
- # beginners (89)
- # calva (12)
- # cljdoc (7)
- # cljsrn (5)
- # clojars (1)
- # clojure (19)
- # clojure-dev (6)
- # clojure-europe (2)
- # clojurescript (12)
- # conjure (7)
- # cursive (4)
- # fulcro (28)
- # graphql (6)
- # gratitude (2)
- # introduce-yourself (2)
- # jobs (1)
- # jobs-discuss (26)
- # off-topic (2)
- # pathom (22)
- # pedestal (2)
- # podcasts-discuss (10)
- # re-frame (9)
- # reitit (8)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (1)
- # tools-deps (27)
- # xtdb (11)
For others who are curious - it's a performance thing, open-db
avoids creating a bunch of low-level resources each time you want to execute a small query
My understanding is about lazy evaluation that not all query results are materialized.
As you have talked about performance, what exact underlying resources are relevant? And how it is shared with different (open-db) requests?
Lazy evaluation, whether through open-q
or open-entity-history
is mostly orthogonal, can be combined with either db
or open-db
> not all query results are materialized
that's definitely true of open-q
, yep, but only when you don't use :order-by
or a reducing aggregate in the :find
open-db
will share a single KV-store snapshot between requests (which pools caching and underlying iterators), and also a temporal "entity-resolver" cache, see https://github.com/xtdb/xtdb/blob/e2f51ed99fc2716faa8ad254c0b18166c937b134/core/src/xtdb/query.clj#L1961-L1966
> share a single KV-store snapshot between requests specifically, for RocksDB, see https://github.com/facebook/rocksdb/wiki/Iterator#resource-pinned-by-iterators-and-iterator-refreshing and for LMDB a read-only transaction is created https://github.com/xtdb/xtdb/blob/4d2e8d7fb9516562ef3d95926a157356071d501a/modules/lmdb/src/xtdb/lmdb.clj#L220
How can change the query to get a whole set #{[:cat #{“dog”, “mouse”}]} instead of #{[:cat “dog”] [:cat “mouse”]}. I am interested in the normal :find way.
(xt/submit-tx node [[::xt/put
{:xt/id :cat :meow-follows #{"dog" "mouse"}}]])
(xt/q
(xt/db node)
'{:find [e z]
:where [[e :meow-follows z]]})
I would try using https://docs.xtdb.com/language-reference/datalog-queries/#pull syntax for this
'{:find [(pull e [:meow-follows])]
:where [[e :meow-follow z]]}