Fork me on GitHub
#datomic
<
2017-08-03
>
devth02:08:34

what's an example of when you'd want to use a :db.unique/value instead of a :db.unique/identity?

mgrbyte08:08:32

"Unique values have the same semantics as unique identities, with one critical difference: Attempts to assert a new tempid with a unique value already in the database will cause an IllegalStateException."

devth12:08:02

yep, read the docs 🙂 just trying to figure out the intended use case.

devth13:08:02

new question: if you d/delete-database a db with underlying sql storage, does it drop the associated rows in sql?

favila13:08:55

No. That happens when you run gc-deleted-databases

devth13:08:31

you mean gc-storage?

devth13:08:07

haven't run that yet. good idea to run it on some regular schedule i assume?

favila13:08:07

No gc storage is for active dbs

devth13:08:30

ah, command line api. i was looking at the clojure api

devth13:08:32

thanks, good stuff

devth13:08:18

right but having a hard time thinking of a use case

matthavener13:08:35

if you had an entity that was totally immutable (never updated)

matthavener13:08:46

then you wouldn’t want to upsert it, devth

devth13:08:13

so i take it ppl use identity more often?

devth13:08:45

i.e. unless you have a special reason to use value, default to using identity

matthavener13:08:46

that’s probably fair

matthavener13:08:17

i would say unless you know you’re going to upsert, just use value, schema change allows those attributes to change later anyways

devth13:08:37

oh, i thought that was unalterable

uwo19:08:19

say I want to add a derived field to a reference, and there are many of this type in the system (memory large). Let’s call the ref a location, cause that happens to be what I’m updating currently. In a transaction function, I could query all locations and then map over and return the new datom for each. If I didn’t want to pull all results in to memory at once, what would i do? Also, if I do this within a transaction function the size of the returned transaction would be enormous. I should probably fix that as well, no?

uwo19:08:47

I should probably do this outside of a transaction function, and use d/datoms, shouldn’t i?

favila20:08:43

"add a derived field to a reference" means what?

favila20:08:57

I'm not clear what you're querying and transacting

favila20:08:49

are you trying to compute some extra attribute+value on an entity based on input from a query, and do it in bulk across a bunch of entities?

uwo20:08:14

I’m just adding a new attribute to an entity in the system, and there are a lot of entities I need to update. For each new attribute is a projection of many existing attribute on said entity. I think the answer to your last question is, yes. @favila

favila20:08:00

why are you desiring a transaction function?

uwo20:08:26

no, reason. I realized that was not a good direction

uwo20:08:39

my guess is I should use d/datoms to iterate over all the entities and then tx-pipeline them in

favila20:08:09

options are: 1. don't transact. if purely a derived value, just have the peer derive it as needed. 2. transact derived and non-derived together 3. transact derived separately later (possibly in bulk; be careful that entity hasn't changed in a way that invalidates the derived value).

favila20:08:41

you can't use a transaction function for derived values because these cannot see the result of the transaction they are within.