Live data from Hacker News

Representing Graphs in PostgreSQL

richard-towers.com

21–30 of 80 posts

Re: Representing Graphs in PostgreSQL

#21

Im a big fan of GraphDatabase's since about 10 years. I even wrote my own "in memory graph storage" in golang for a specific use case that none of the big GraphDatabase's could cover at the time. That said - i WISH people would embrase the existing GraphDatabases more and make the hosters support them as standard, rather than abusing existing relational databases for graph purposes. And to make it clear,i'm not talki…

> rather than abusing existing relational databases for graph purposes.

In my experience, the vast majority of graphs can be embedded in relational databases just fine and most people don't want general graph querying. People just don't like optimizing queries (or equivalently the schema to enable such queries).

I personally have never seen a pitch for graph databases that makes them seem attractive for more than data exploration on your local machine.

Re: Representing Graphs in PostgreSQL

#22
It is always good to know, at what point does "Postgres as X" break down. For instance, I know from experience that Postgres as timeseries DB (without add-ons) starts to break down in low billions of rows. It would be great to know that for graph DBs as well. I think a lot of people would prefer just to use Postgres if they can get away with it.

Re: Representing Graphs in PostgreSQL

#23

I thought this was going to be about querying a Postgres table with a graph query language (SQL/PGQ). Indeed this is coming to Postgres eventually. https://www.postgresql.org/message-id/flat/a855795d-e697-4fa... https://ashutoshpg.blogspot.com/2024/04/dbaag-with-sqlpgq.ht...

Postgraphile[1] does this via GraphQL, or have i misunderstood what you're referring to?

1: https://www.graphile.org/postgraphile

Re: Representing Graphs in PostgreSQL

#25
post #20

I thought this was going to be about querying a Postgres table with a graph query language (SQL/PGQ). Indeed this is coming to Postgres eventually. https://www.postgresql.org/message-id/flat/a855795d-e697-4fa... https://ashutoshpg.blogspot.com/2024/04/dbaag-with-sqlpgq.ht...

Like apache age (postgres with cypher support) https://age.apache.org/

What I'm talking about is going to be committed into Postgres.

Re: Representing Graphs in PostgreSQL

#26
post #23

I thought this was going to be about querying a Postgres table with a graph query language (SQL/PGQ). Indeed this is coming to Postgres eventually. https://www.postgresql.org/message-id/flat/a855795d-e697-4fa... https://ashutoshpg.blogspot.com/2024/04/dbaag-with-sqlpgq.ht...

Postgraphile[1] does this via GraphQL, or have i misunderstood what you're referring to? 1: https://www.graphile.org/postgraphile

Nope I'm talking about something getting committed to Postgres itself.

Re: Representing Graphs in PostgreSQL

#27
If you need some "Routing Graph" - check the pgRouting library https://pgrouting.org/

  "pgRouting library contains following features:
  All Pairs Shortest Path, Johnson’s Algorithm
  All Pairs Shortest Path, Floyd-Warshall Algorithm
  Shortest Path A*
  Bi-directional Dijkstra Shortest Path
  Bi-directional A\* Shortest Path
  Shortest Path Dijkstra
  Driving Distance
  K-Shortest Path, Multiple Alternative Paths
  K-Dijkstra, One to Many Shortest Path
  Traveling Sales Person
  Turn Restriction Shortest Path (TRSP)"\*

see more: https://docs.pgrouting.org/latest/en/pgRouting-concepts.html...

Re: Representing Graphs in PostgreSQL

#28
post #23

Earlier quoted context omitted.

Postgraphile[1] does this via GraphQL, or have i misunderstood what you're referring to? 1: https://www.graphile.org/postgraphile

Nope I'm talking about something getting committed to Postgres itself.

Ah I see, yes it'd be pretty awesome to have Postgres be even more of a Swiss army knife of databases.

Re: Representing Graphs in PostgreSQL

#29
post #6

This time it must be me... Bilbo is not Frodo's father (Frodo is actually Bilbo's first and second cousin, once removed)

Very good, and also Frodo refers to Bilbo as his "uncle".

It's also just right up front in the fellowship, he adopts Frodo because he never got around to finding a partner, implied because of his stewardship of the ring.

Re: Representing Graphs in PostgreSQL

#30

Earlier quoted context omitted.

I got bitten by the same, we were looking at switching to memgraph (which is also Cypher, but C++ rather than Java), sadly abandoned for other reasons ...

What reasons? Would love to know for future ref. If your org is amenable to Google Spanner or already using Spanner, it has preview support for Cypher and graph semantics: https://cloud.google.com/spanner/docs/graph/overview

Unrelated to the tech, just the graph-based algorithm (recommender stuff) that we had in mind did not give us the results we were hoping for ... and other things were queued up to be tried ...
Post reply on HN