datalevin

2025-05-07T19:31:30.753509Z

Hi, i'm trying to use fill-db to load a bunch of data. But, it expects [e a v] values is there a way to build datom/eav from tx-data i.e?

[{:chunk/id "foo" :chunk/name "baz"} ...]

Huahai 2025-05-07T22:51:59.993909Z

You will have to do it yourself

Huahai 2025-05-07T22:53:17.211319Z

Turning tx data into datom is exactly what transactions do. It is expensive.

👍 1
Huahai 2025-05-07T23:08:19.318119Z

Tx is expensive because database doesn’t know your data, so it has to check everything. But if you know your data, you can write code to do the transformation into datoms yourself. That’s what Clojure good at. Fill-data is for that purpose.

Huahai 2025-05-07T23:10:27.733209Z

See the JOB benchmark code for an example of translating a bunch of CSV files into datoms. Pay attention to how we come up with entity ids.

đź‘€ 1
Huahai 2025-05-07T23:12:20.820099Z

It’s a highly normalized data set, entities are connected. It is still possible to translating into datoms without much effort

Huahai 2025-05-07T23:15:58.981869Z

With that code, it took about 20 minutes to load all that CSV files, a few times slower than PostgreSQL COPY commands, but it is still doable. It would probably took hours if we do transaction.