This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-12
Channels
- # aleph (3)
- # announcements (7)
- # babashka (22)
- # beginners (44)
- # calva (19)
- # chlorine-clover (1)
- # cider (20)
- # clj-kondo (55)
- # clojure (100)
- # clojure-austin (9)
- # clojure-europe (19)
- # clojure-italy (19)
- # clojure-nl (13)
- # clojure-portugal (2)
- # clojure-uk (7)
- # clojurescript (38)
- # community-development (3)
- # conjure (2)
- # cryogen (57)
- # cursive (6)
- # datalog (3)
- # datomic (24)
- # emacs (17)
- # exercism (8)
- # fulcro (3)
- # holy-lambda (8)
- # jobs (6)
- # jobs-discuss (9)
- # joker (3)
- # lambdaisland (5)
- # leiningen (5)
- # music (9)
- # nextjournal (1)
- # nrepl (2)
- # off-topic (9)
- # other-languages (4)
- # pathom (6)
- # polylith (23)
- # re-frame (5)
- # reagent (5)
- # remote-jobs (1)
- # reveal (1)
- # shadow-cljs (3)
- # tools-build (1)
- # tools-deps (3)
- # xtdb (2)
Hi @danvingo! We have certainly considered adding a query planner to Datomic, and might do so in the future. A good query planner has an obvious benefit: It makes queries run faster without needing any help from the user. OTOH, as @oscarlinusericsson points out, query planners can sometimes cause surprising and slow results. If there is no user control, this can be catastrophic. If the query planner includes user knobs, the "obvious benefit" becomes less obvious.
Thanks @U072WS7PE ! I appreciate you taking the time to reply š
Perhaps instead of a "knob" there could be just a "button" (on and off) that can be passed as an option to q
Agreed. Related: we are certainly interested in specific performance problems as folks encounter them.
Re performance: Here is a gist reproducing an OOM with a simple query: https://gist.github.com/ivarref/0d3d34eeeffbc4625d6120727368e405 I am already in contact with Jaret B on this one (via support)
Does anyone know when the concept of immutability within databases arose and who is the originator of this idea?
isn't immutability the obvious choice? who came up with the crazy idea of mutating data in place?

Agree. Not me.
Hi, Iām struggling to get my head around a basic use-case for Datomic (years of relational thinking are taking some time to unwind!). To boil the problem down to its simplest, consider a datomic schema as follows:
{:db/ident :foo/id
:db/valueType :db.type/uuid
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one}
{:db/ident :foo/foo-description
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :foo/bars
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:db/isComponent true}
{:db/ident :bar/id
:db/valueType :db.type/uuid
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one
}
{:db/ident :bar/bar-description
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
}
So I have an entity foo
that can contain bar
entities (in the foo/bars
cardinality many ident). Now, I need to lookup the parent foo
entity using an attribute from the child bar
entity (in this case, bar-description
. The way I am trying to achieve this right now is with the following code:
(def foo-id (UUID/randomUUID))
(def bar-id (UUID/randomUUID))
(def foo-data [{:foo/id foo-id :foo/foo-description "foo description 1"}])
(def bar-data [{:bar/id bar-id :bar/bar-description "bar description 1"}])
(d/transact conn {:tx-data schema})
(d/transact conn {:tx-data foo-data})
(d/transact conn {:tx-data [{:foo/id foo-id :foo/bars bar-data}]})
(d/q '[:find ?foo-desc
:in $ ?bar-desc
:where [?bar :bar/bar-description ?bar-desc]
[?foo :foo/bars ?bar]
[?foo :foo/foo-description ?foo-desc]]
db ["bar description 1"])
Given the transacted data, I would have expected the final query to return āfoo-description-1", but instead I am getting an empty list. Iām clearly missing something here but Iāve spent the entire day at this point trying to figure it out, so maybe someone here could point out where Iām going wrong. Thanks in advance!In your query I believe you want to pass "bar description 1"
as the argument not ["bar description "]
For your parent lookup functionality you probably will want to use a https://docs.datomic.com/cloud/query/query-pull.html#reverse-lookup if you havenāt experimented with it already.
Something along the lines of:
(d/q '[:find (pull ?e [{:foo/_bars [*]}])
:in $ ?bar-desc
:where [?e :bar/bar-description ?bar-desc]]
(d/db conn) "bar description 1")
remove the square brackets fromĀ `["bar description 1"]`Ā in the query (and use (d/db conn)
to see the "new" db
Your db
in the query arg, does it include the results of the transaction? Where was it def-ed? Remember databases are immutable. Consider using the db-after from the d/transact call
Thanks for the feedback, that was the problem alright. I had a separate issue with the underlying code from where I derived this simple example which I have also fixed now. Seems to be working well so far.
Hi, Iāve updated to newest version of datomic cloud (ions),
{,,,
"group-cft-version":"936",
"group-cloud-version":"9118",
,,,
"status":"running"}
In release notes: https://docs.datomic.com/cloud/changes.html#936-9118, Iām seeing āUpgraded Clojure to 1.10.3ā, yet on ion-dev push, Iām seeing overrides (āThe :push operation overrode these dependencies to match versions already running in Datomic Cloud. To test locally, add these explicit deps to your deps.edn.ā) to org.clojure/clojure #:mvn{:version "1.10.1"}
, Iām not sure how to interpret this? There is this discrepancy on other dependencies as well, itās quite confusing šIs there a way to check whatās actually on the classpath of an ions system? From the above I gather e.g. that itās running clojure 1.10.1 and is supposed ot run 1.10.3 according to the changelog, am I misinterpreting?
You probably didn't upgrade ion-dev tool used to :push and :deploy. AFAIR it's that tool that checks the deps to warn about overrides.
In other words, that tool uses a static list of deps and versions, it's not a truly dynamic check.
hmm, thanks for an idea, but I have Iām onĀ `com.datomic/ion-dev {:mvn/version "1.0.294"}`Ā which is the latest
If you check the first ~50 messages logged in the CloudWatch logstream for your app after a deployment, a few of them contain lots of details and also show the classpath. Those that are about how the system is booted up. (The logstream search field is sometimes useful but can also trip you up.)
Alright! that is a very good tip indeed, will read through that carefully. Thanks Daniel, really appreciate your help!
And I felt sorry to not provide more guidance! Thanks for the appreciation. I'm in a rush... š
This is plenty helpful. Overall datomic is very logical & docs are decent, but sometimes I come across some more opaque corner especially around ops. Community is quite small and itās not open source so itās not always easy to find answers, thatās Iām particularly grateful to anyone who gets out of their way to help š So, Cheers š¹