xtdb

refset 2025-05-09T09:33:02.362929Z

tatut 2025-05-09T09:43:54.621559Z

in v1 there's a neat xt/listen that you can use to make automagically updating things by reacting to new txs, is there something comparable for v2?

tatut 2025-05-12T11:53:48.395889Z

for reference from a lightweight portal we did with xt1 back in the day, https://github.com/solita/lipo/blob/main/src/lipo/portlet/comments.clj#L22 you can create an automatically updating source that listens to new transactions and has a customizable "should update?" function that gets the tx data and determines if there is need to rerun the query... very handy, you just define the query and check fn and your UI is always up to date

🙏 1
jarohen 2025-05-09T09:53:03.707089Z

hey @tatut 👋 not currently, I'm afraid - openly, we haven't had a client/design partner request it yet, so it hasn't yet made it up the order. it's definitely an interesting feature, though, looking forward to implementing it 🙂

refset 2025-05-09T10:00:05.112529Z

The design space here is interesting. (Ab)using the Postgres NOTIFY/LISTEN paradigm is one option - although even CockroachDB https://github.com/cockroachdb/cockroach/issues/41522 - instead they have a whole other CHANGEFEED https://www.cockroachlabs.com/docs/stable/create-changefeed In the meantime you should be able to get by with a simple polling query, and if that's not fast enough currently (depending on exactly which (meta)data you're polling for) we should be able to make it faster.

refset 2025-05-09T10:00:32.914679Z

Over the HTTP API we could conceivably support SSEs (but we have no plans to extend the HTTP API currently at all - pgwire is the blessed, stable API)

tatut 2025-05-09T10:38:17.519019Z

ok, thanks... so polling is the way at the moment

tatut 2025-05-09T10:39:36.299149Z

for making a UI that automatically updates by rerunning relevant queries, you'd need a changefeed that at least the ids of the entities that have changed

👍 1
📝 1
refset 2025-05-11T21:20:05.532889Z

> you'd need a changefeed that had at least the ids of the entities that have changed It just occurred to me to mention that a slight variation of https://docs.xtdb.com/quickstart/sql-overview#a-delta-of-changes-to-a-table-since-a-given-system-time example in the docs is probably the query you're essentially looking to be able to poll efficiently, e.g.

SELECT _id FROM people FOR SYSTEM_TIME FROM TIMESTAMP '2020-01-01Z' TO NULL