Re:Ask HN: Why are relational DBs are the standard instead o...
by aptxkid on Sunday October 03, 2021 @09:50AM
(#28737136)
How a graph DB index the data to support this query?
Re:Ask HN: Why are relational DBs are the standard instead o...
by hobofan on Sunday October 03, 2021 @03:57PM
(#28740017)
Usually there are indices on the properties of specific labels (e.g. for the .population of :Country), in graph databases with labeled nodes (most of them), so in general pretty much the same as in a relational database.
Re:Ask HN: Why are relational DBs are the standard instead o...
by 3dfan on Sunday October 03, 2021 @09:21AM
(#28736978)
Is that the shortest way to write it in Cypher?
SQL needs 48 chars:
SELECT name FROM cities WHERE population>1000000
Cypher needs 57 chars: MATCH (n:cities) WHERE n.population>1000000 RETURN n.name
I would be very hesitant to use a language that needs 19% more code to express the same thing.
Re:Ask HN: Why are relational DBs are the standard instead o...
by joelschw on Sunday October 03, 2021 @09:51AM
(#28737143)
This example doesn't demonstrate any of the power of Cypher, the whole point is matching a pattern than corresponds to a traversal, which as it happens is much much more elegant than recursive SQL
Re:Ask HN: Why are relational DBs are the standard instead o...
by angelzen on Sunday October 03, 2021 @10:01AM
(#28737199)
Would be nice though to have an example that does demonstrate the power of Cypher.
Re:Ask HN: Why are relational DBs are the standard instead o...
by clpm4j on Sunday October 03, 2021 @10:34AM
(#28737479)
SELECT p.ProductName
FROM Product AS p
JOIN ProductCategory pc ON (p.CategoryID = pc.CategoryID AND pc.CategoryName = "Dairy Products")
JOIN ProductCategory pc1 ON (p.CategoryID = pc1.CategoryID) JOIN ProductCategory pc2 ON (pc1.ParentID = pc2.CategoryID AND pc2.CategoryName = "Dairy Products")
JOIN ProductCategory pc3 ON (p.CategoryID = pc3.CategoryID) JOIN ProductCategory pc4 ON (pc3.ParentID = pc4.CategoryID) JOIN ProductCategory pc5 ON (pc4.ParentID = pc5.CategoryID AND pc5.CategoryName = "Dairy Products");
-----------------------------------------------
MATCH (p:Product)-[:CATEGORY]->(l:ProductCategory)-[:PARENT*0..]->(:ProductCategory {name:"Dairy Products"}) RETURN p.name
Re:Ask HN: Why are relational DBs are the standard instead o...
by somewhereoutth on Sunday October 03, 2021 @05:18PM
(#28740586)
So basically allow 'named joins' in SQL and we are done.
Same query in Cypher (the language used by e.g. Neo4J, RedisGraph):