Fork me on GitHub
#xtdb
<
2022-08-15
>
roklenarcic20:08:03

I went through a lot of docs and some tutorials and I still dont know the answer to these questions: • when doing transactions, can I have a temp ID like in Datomic and have xtdb provide the id for me? • I don’t see any docs on schemas… no schemas? Can I assume that each property in the document has an index on it and I can efficiently query it? • Is querying on a predicate like (< 3 my-num 10) efficient? • I don’t specifically see refs mentioned, can an entity reference another entity?

refset23:08:50

Hey @U66G3SGP5 🙂 > when doing transactions, can I have a temp ID like in Datomic and have xtdb provide the id for me? nope, all IDs in XT are explicit (and, in the case of generating them within a transaction function, must be deterministic) > I don’t see any docs on schemas… no schemas? Can I assume that each property in the document has an index on it and I can efficiently query it? Correct, each top-level attribute is indexed in both directions (AEV and AVE) and the values are hashed prior to indexing, so anything & anything can be compared (/joined) on-the-fly > Is querying on a predicate like (< 3 my-num 10) efficient? For simple queries, yes, these are called "range constraint predicates" internally and are accelerated. If the query is more complex however, then the details/implications of 'efficient' can vary due to the heuristics in the query planner, see https://github.com/xtdb/xtdb/issues/348 > I don’t specifically see refs mentioned, can an entity reference another entity? As hinted above, yes, and because there's no explicit schema being tracked it all happens dynamically at query time (all top-level values are automatically indexed as if they could potentially be joined with a matching entity ID, via hash-based comparisons)

🙏 1
roklenarcic13:08:04

Than you for your exhaustive answer. One more question. Datomic has attribute in schema :db/isComponent which is basically like cascade delete in databases. Is there a similar thing in xtdb?

zeitstein15:08:49

There is not as there is no schema in XTDB. Would need to create this manually for your data model.

1