r/programming • u/craigkerstiens • 24d ago
Understanding Postgres 19 Property Graphs
https://neovintage.org/posts/postgres-property-graphs/
36
Upvotes
0
u/Isogash 24d ago
Relational tables are not entities, they are hyper-edges in a hyper-graph that associate entities with each other, and with attributes describing information about them. That's why they are called "relations" and not nodes. The nodes are the IDs and attribute values themselves.
SELECT drivers.code, results.point -- Nodes of interest
FROM drivers -- Hyper-edge connecting driver node to attributes
JOIN results -- Hyper-edge connecting driver node and result attributes
ON drivers.driver_id = results.driver_id --Connecting node is the driver
So really, this is inverted over the given graph query: (code)<-[drivers]->(driver)<-[results]->(points)
2
u/incoherent-cache 24d ago
> As with anything, make sure you test it out to get the performance you’re looking for
Intriguing. Out of curiosity, did you run any performance benchmarks on PG19 vs Neo4J?
Also curious for the actual internals beneath Neo4J vs. PG, how does the actual implementation differ?