xtdb

avi 2024-07-14T14:49:48.168709Z

🙋 Hi, in v2, how should I reference a nested object key/property in a select? 🧵

avi 2024-07-14T14:50:07.396449Z

For example, after this insert:

INSERT INTO locations (_id, owner)
VALUES (1, {id: 'foo'})
This select doesn’t return what I’d hoped:
SELECT _id, owner.id
FROM locations
it returns only:
| _id |
|-----|
| 1   |
What am I missing? Are there any docs where I could have looked this up? I did try searching, I promise...

avi 2024-07-14T17:56:29.962209Z

Thanks! Is that written anywhere in the docs?

Oliver Marshall 2024-07-14T20:16:02.651889Z

I don't believe so, I seem to remember it came from the SQL standard. One to improve on either way!

👍 1
Oliver Marshall 2024-07-14T20:21:16.618639Z

Ah, found this issue that explains things: https://github.com/xtdb/xtdb/issues/3436

👏 1
Nikolas Pafitis 2024-07-14T20:59:03.572059Z

I'm just pondering here on the hammock, could a fully reactive API for XTDB be built if there was an r2dbc driver for apache arrow?

refset 2024-07-14T21:16:35.578929Z

Hey @pafitisnick https://github.com/apache/arrow-adbc/issues/547 would be a good upstream ADBC drive issue to track / subscribe to Longer term though I don't know if r2dbc has a meaningful role if everyone switches to using virtual threads - looking at https://mariadb.com/resources/blog/benchmark-jdbc-connectors-and-java-21-virtual-threads/ > [...] in terms of performance, virtual threads dethrone R2DBC

Nikolas Pafitis 2024-07-14T21:17:58.415809Z

How would vthreads help with reactivity though?

refset 2024-07-14T21:21:00.157619Z

ah right, I was thinking about async more generally - but I guess you mean more like for listening to tx-log changes? or if we were to implement Incremental View Maintenance?

Nikolas Pafitis 2024-07-14T21:21:15.097349Z

I'm thinking of queries that efficiently listen to changes

👍 1
refset 2024-07-14T21:27:21.545579Z

a reactive tx-log listener query like SELECT * FROM _txs ORDER BY _id ASC would be viable in the not-so-distant future, but what other kinds of queries are you hoping to be efficiently reactive? Anything that involves a join is like not possible without introducing an IVM engine (or if you can tolerate some latency then batch materialized view recalculations could be useful here also)

Nikolas Pafitis 2024-07-14T22:04:39.923939Z

I think I misunderstood r2dbc

Nikolas Pafitis 2024-07-14T22:05:25.038519Z

I'm just trying to find a database that I can use in my hyperfiddle/electric apps, that would allow to make a query and stream any changes, thus be able to make highly interactive realtime webapps

👍 1
Nikolas Pafitis 2024-07-14T22:08:29.236279Z

It's a trend, where a lot of databases support "reactive" (or "live", "real-time") queries, an example is retthink, pocketbase, convex, surreal etc. Ideally for me I'd want to use XTDB, for all the other features XTDB provides, (bitemporality, graph queries, edn native and so on)

avi 2024-07-14T22:12:52.355329Z

🙋 Hi, another v2 SQL question, this time about joining across tables… 🧵

FiVo 2024-07-15T07:45:22.521719Z

This is another one of those nested columns not being accessed correctly issues.

Oliver Marshall 2024-07-15T07:45:47.602409Z

Jinx

avi 2024-07-15T14:56:15.509099Z

Thank you!

avi 2024-07-14T22:14:44.261449Z

I’m running first two insert statements:

INSERT INTO partners (_id, name)
VALUES (1, 'Aptera')

INSERT INTO partner_locations (_id, partner, name)
VALUES (1, {id: 1}, 'Carlsbad')
and then I’m trying to join across these two "tables":
select p.name, pl.name as location_name
from partners p
  left outer join partner_locations pl on pl.partner.id = p._id
But I’m only getting back the first column name; no column named location_name is coming back. What am I doing wrong here?