4 ms·
> Recursive queries will not scale to handle _very_ large edge tables What do you consider large ? We have a 12-year old telco application with a few million o
by liotier 4y ago
> Recursive queries will not scale to handle _very_ large edge tables
What do you consider large ? We have a 12-year old telco application with a few million objects in Neo4J, doing fault impact calculations... Would PostgreSQL handle that easily nowadays ?
- simonw 4y agoMy hunch is that a few million objects is pretty tiny these days - you could probably write a script to import all of them into PostgreSQL in a few minutes and try it out yourself to see how it behaves.
- simonw 4y agoI tried it against SQLite. I got ChatGPT to write me a script that would insert 1m edges and 1m nodes: https://gist.github.com/simonw/c16ce01244760e186a3a0aa3fee0405d https://gist.github.com/simonw/c16ce01244760e186a3a0aa3fee04... Then I ran that query again and it seems to return results in about 80ms: https://lite.datasette.io/?sql=https://gist.github.com/simonw/c16ce01244760e186a3a0aa3fee0405d#/data?sql=WITH+RECURSIVE+friend_of_friend+AS+%28%0A++SELECT+edges.next_node%0A++FROM+edges%0A++WHERE+edges.previous_node+%3D+14%0A++UNION%0A++SELECT+edges.next_node%0A++FROM+edges%0A++JOIN+friend_of_friend+ON+edges.previous_node+%3D+friend_of_friend.next_node%0A%29%0ASELECT+nodes.data%0AFROM+nodes%0AJOIN+friend_of_friend+ON+nodes.id+%3D+friend_of_friend.next_node%3B https://lite.datasette.io/?sql=https://gist.github.com/simon...
- eurasiantiger 4y agoNot very realistic example, you need to be requesting some actual fields across nodes and doing some filtering on at least strings and dates, maybe geo areas as well.
- simonw 4y agoGo ahead and try it! I've documented all of the tools you need to run some detailed experiments against SQLite entirely in your browser here.
- ellisv 4y agoIt depends a lot on how connected the graph is and whether you can fit it in memory.