This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-24
Channels
- # aws (2)
- # babashka (27)
- # beginners (97)
- # calva (1)
- # cherry (12)
- # cider (6)
- # clara (12)
- # clj-kondo (24)
- # clj-on-windows (4)
- # cljfx (14)
- # clojure (54)
- # clojure-australia (3)
- # clojure-europe (26)
- # clojure-nl (1)
- # clojure-norway (4)
- # clojure-uk (9)
- # clojurescript (65)
- # conjure (5)
- # cursive (7)
- # datomic (18)
- # emacs (6)
- # helix (2)
- # honeysql (1)
- # jobs (1)
- # joyride (15)
- # kaocha (2)
- # lsp (10)
- # malli (5)
- # nbb (12)
- # observability (5)
- # off-topic (5)
- # reitit (2)
- # releases (4)
- # ring (1)
- # sci (17)
- # shadow-cljs (34)
- # testing (29)
- # tools-deps (45)
- # vim (7)
- # xtdb (6)
Good morning! I have the following code:
(defn db-fixture
[f]
(dl/divert-system {:system "yardwerkz-dev" :storage-dir :mem})
(f)
(dl/release-db {:system "yardwerkz-dev"
:db-name datomic/database-name
:storage-dir :mem}))
(use-fixtures :each db-fixture)
It seems that in my unit tests, the entities that I put into the database (which should be diverted) are persisted to the cloud. When I run my tests two times in a row, I get a uniqueness constraint. I am sure I have made a mistake. Can anyone help me? Thanks.i don't use cloud, but on prem the db uri has to look something like "datomic:<mem://memorydb>" for in memory db to work
@UGNMGFJG3 why don't u use dev-local
for testing purposes?
https://docs.datomic.com/cloud/dev-local.html
Hi all,
Are queries (`d/q`) on d/history
db optimized in some way? Or do they cause seeking through all assertions/retractions?
it still uses the same indexes in their sort orders eavt aevt avet vaet - but they contain more datoms because all true and all false instead of latest-only-true datoms are present
given that t is in this ordering, that means oldest stuff is fastest to work with cos its at the top of the index when you look
this will only feel slow if you're working with large numbers of entities, but if e.g. looking at the history of a single entity, it should feel not substantially slower
(sorry end of day brain, not speaking too clearly 😅 )
Right, so considering eavt index, something like this should be pretty fast at all times? (as e and a are given)
...
:in $ ?eid ?e-attr ?asserted-value
:where
[?eid ?e-attr ?asserted-value ?tx true]
...
that query is going to cut the DB down a lot, but if your DB is being abused and you have 1 billion records that satisfy it, then you could end up in pain town too.
It's not looking for all transaction for an entity, it's looking for a transaction on a specified entity and attribute with specific assertion value.
it should be pretty fast, but you should also be profiling as well. cus a slow query is ok in some places, and a fast query isn't fast enough in others. you can also seed your DB with a ton of data and try your query on it, that'll sort of give you an estimate of how it'll perform in the scenarios you test. i do this when trying to figure out how long my brute force solutions will work for.
if you have e a and v and you want all the t then history will be fast enough imho 🙂