News for hackers. Stuff that matters.
Re:Representing Graphs in PostgreSQL by demaga on Monday February 17, 2025 @09:17AM (#43079226)
I've done almost exactly the kind of thing described in article for a couple millions of rows. It broke down when I needed to find "friends of friends" of depth 6. None of the optimizations I could come up with helped. Neither did Apache Age.

Maybe I'm just not skilled enough to handle such a workload with Postgres. But Neo4j handled it easily

Re:Representing Graphs in PostgreSQL by eurg on Monday February 17, 2025 @09:30AM (#43079354)
I'm not sure if you are serious or joking. "6 degrees of separation" is the famous radius for how many steps are needed such that everyone is connected.

https://en.wikipedia.org/wiki/Six_degrees_of_separation

Re:Representing Graphs in PostgreSQL by demaga on Monday February 17, 2025 @11:09AM (#43080377)
Except that it wasn't about people at all? I was just referring to a _type_ of query
Re:Representing Graphs in PostgreSQL by ffsm8 on Monday February 17, 2025 @11:21AM (#43080508)
What kind of data was it, of I may ask?

Graph databases have a very narrow usecase, and it's almost always in relation to people - at least ime.

Though the data type isn't really important for the performance question, the amount of data selected is. So a 6-level depth graph of connections that only connect 2-3 entities would never get into performance issues. You'd be able to go way beyond that too with such a narrow window. (3 entity Connections on 6 level join would come out to I believe ~750 rows)

If you're modeling something like movies instead, with >10 actors per production you're looking at millions of rows.

Re:Representing Graphs in PostgreSQL by derefr on Tuesday February 18, 2025 @05:42PM (#43096060)
Network analysis of financial transactions to detect "layering" (onion-routed money laundering) paths, probably.
Re:Representing Graphs in PostgreSQL by zaphirplane on Tuesday February 18, 2025 @02:11AM (#43086863)
Too funny, enjoy the vote
Re:Representing Graphs in PostgreSQL by JoelJacobson on Monday February 17, 2025 @07:26PM (#43084631)
I tested PostgreSQL vs Neo4j with a friends-of-friends query two years ago, and to my surprise it was Neo4j that crashed, not PostgreSQL.

https://github.com/joelonsql/graph-query-benchmarks

I haven't tried the latest versions of both databases though.