Edit: draft moved to the main website. Will publish officially soon.
Just wrote up the XTDB vs. Postgres section.
(Also, this essay writing stuff takes foreverâŚ)
Just wrote up the XTDB vs. Datomic section and made some light edits to the rest of the essay. The draft is now complete.
@refset would you mind giving the whole essay a read to make sure Iâm not spreading any misinformation ha ha/if anything else comes to mind?
A fact-check on this would also be nice.
Thanks for the ping - no misinformation that I can see! Itâs perhaps worth adding/clarifying (if only here):
- Datomicâs schema offers an opinionated, RDF-inspired information model (with defined scalar types, composite attributes, reified transactions, upsert etc.) whereas XTDB is âdynamicâ and defers all control to userspace. As for âwith bitemporality, it was just too tricky to do schema in a general wayâ â itâs more that the solutions to the bitemporal schema problem all required creating the dynamic core first, rather than there being some ~artificial implementation-related compromise
- Datomic exposes indexes for direct data access and queries rely on user-specified join ordering, whereas XTDB only encourages data access via high-level queries
- Datomic Cloud promotes running compute using âIonsâ and leans heavily into AWS for scaling (with EFS etc.), whereas XTDB is purely offering node-local indexes running on SSDs. There are a huge number of differences in implementation details and operational considerations consequently
- Performance between the two could vary substantially for different use cases. It probably goes without saying, but when evaluating any database itâs definitely important to validate the performance and scaling for your application workload - there is no âone size fits allâ
thank you this is great!
This is a great read already, thanks for making the draft public.
Can I ask for more detail (or a reference link) about storing the schema in the database? After 15 years with RDBMS, using schema-less DBs feels like driving without a seat belt and I am looking for resources to make this paradigm shift and use XTDB more confidently. The link about migrations was eye opening in that regard.
Cheers
Glad itâs helpful! If youâre not already familiar with how Biffâs schema-in-code approach, you can take a look at these:
- How Biffâs schema definitions look
- What it looks like to submit a transaction with Biff thatâs checked against the schema
- Biff reference docs for schema and transactions
To clarify, this differs from what the datomic articles refers to as âschema-implicitââthe schema is explicit, itâs just stored in a Clojure var and only enforced by clients to the database, not by the database itself. That also means the current version of the schema thatâs active is tied to the currently deployed code. For my projects thatâs been fine, but if you had a database that was accessed by multiple services, you might prefer the database itself to be the source of truth for what version of the schema is currently active. So that would be the main benefit of going beyond what Biff already does for schema.
As for the implementation, there might be an XT document for each document type, like {:xt/id :biff.schema/user, :biff.schema/malli [:map ...]}
⌠or there could even just be a single document for all the schema, like {:xt/id :biff/schema, :biff.schema/malli {:user ..., :msg ...}}
.
Though I should mention that even in this case, it would still be the clientâs responsibility to load the schema and enforce it when submitting transactions; there wouldnât be any schema-checking enforced by XT itself, similar to what you get in RDBMS/Datomic. So there could be some footgun potential there for submitting transactions without going through the schema checks
Thanks a ton for the detailed answer.
I appreciate the clarification about what âstoring the schemaâ entails, and especially that it is still user responsibility to retrieve said schema and check against it.
By the wayâdoes this mean that XT might at some point come with (optional?) schema enforcement baked in?
Thatâs the plan, âgradual schemaâ