xtdb

Akimbo 2025-07-07T22:18:50.679319Z

I'm not totally getting how the clojure API, using xtql, works with XTDB. I can connect to XTDB with next.jdbc, but how do I do it with the Clojure API? With xt/client? Am I able to use connection pooling with that? Edit: NVM, I see you can query a hikari datasource directly.

jarohen 2025-07-08T08:41:09.585309Z

> Is XTQL just for reading, and you use the SQL api for inserting? in addition to XTQL reading, you can also use limited writes - e.g. :put-docs, :delete-docs - but for anything more complicated, yes, I'd use SQL

jarohen 2025-07-08T08:42:18.552239Z

> My understanding is that the XTDB team have rebuilt the Clojure API with XTQL to convert it to SQL under the hood anyway yes - also it's not converted to 'SQL' SQL - just a string inlined within the query: (format "XTQL $$ %s $$" (pr-str your-xtql)

jarohen 2025-07-08T08:42:41.640439Z

i.e. it's an XTDB SQL extension to support XTQL inlined within the query string

seancorfield 2025-07-07T22:57:08.573369Z

Note that you can use XTQL via the SQL API too.

Akimbo 2025-07-07T22:57:50.687979Z

Is XTQL just for reading, and you use the SQL api for inserting?

seancorfield 2025-07-07T23:02:41.471689Z

Personally, I wouldn't use XTQL -- I'm solidly in the SQL camp. I don't know about whether you can run XTQL insert/update ops via SQL -- I haven't tried it but it feels like it ought to work. My understanding is that the XTDB team have rebuilt the Clojure API with XTQL to convert it to SQL under the hood anyway -- the SQL API is the primary one these days.

Akimbo 2025-07-07T23:03:16.069769Z

Got it

seancorfield 2025-07-07T23:04:07.409299Z

I mean, some folks love the XTQL approach but I don't really see the point.

Akimbo 2025-07-07T23:04:56.523619Z

I guess the biggest draw would just be making conditional queries easier. I don't have fun with that in SQL, though I do it a lot.

seancorfield 2025-07-08T00:20:44.220719Z

HoneySQL.

seancorfield 2025-07-08T00:21:04.205909Z

Perfect for constructing conditional SQL queries.

seancorfield 2025-07-08T00:21:14.027859Z

(and it supports XTQL in SQL!)

Akimbo 2025-07-07T23:06:02.960129Z

I'm trying to get a better idea of how the log, storage, and postgres database all work together. In the docker setup image XTDB, it sets the storage to !Local under /var/lib/xtdb/buffers. There appears to be no data in here even when I insert data. Isn't XTDB supposed to persist to this storage when the Log is flushed? The log also has some weird encoding. Is there a special way I am supposed to read the log file?

jarohen 2025-07-08T08:46:09.532549Z

> Is it accurate to say the log is the first entrypoint for transactions? Does XTDB get updates from the log? yes and yes 🙂 the log is only considered a transient store - the XTDB nodes then consume that log and write the transaction results to the more durable object store

chucklehead 2025-07-07T23:40:48.428599Z

I’m not sure where/if it’s documented but I believe the configuration options https://github.com/xtdb/xtdb/blob/main/core/src/main/kotlin/xtdb/api/IndexerConfig.kt#15:

indexer:
  rowsPerBlock: # of rows
  flushDuration: duration string 

chucklehead 2025-07-07T23:51:09.750239Z

Not 100% on the local log format exactly, but it’s going to be some sequence of protobuf encoded messages with the actual trie data and block flush notifications, not really meant for direct consumption by anything but the xtdb nodes.

✔️ 1
Akimbo 2025-07-08T00:07:04.997509Z

Those are the kinds of things I wanted to understand better. For instance, there's docs on backing up the storage vs the logs, and it sounds like there are cases where the logs have a lot of stuff in them. I thought observing them would be the easiest way to understand.

Akimbo 2025-07-08T00:37:29.018679Z

Is it accurate to say the log is the first entrypoint for transactions? Does XTDB get updates from the log? I am just wondering because Kafka is an option, and assume the reason for that is Kafka has high throughput as an append only log.

chucklehead 2025-07-08T01:00:17.525609Z

You might like this article if you haven’t seen it. https://xtdb.com/blog/building-a-bitemp-index-3-storage The predecessors also, but I think this one is more immediately on-topic for what you’re interested in.