top | item 28736927

(no title)

3dfan | 4 years ago

I think the language the developer writes their queries in is most important. It is very easy and logical to express what you want in SQL. Say we want to show a list of cities with more than a million people. Easy:

    SELECT name FROM cities WHERE population>1000000
GraphQL queries on the other hand always look like gibberish to me.

discuss

order

hobofan|4 years ago

Good thing that GraphQL traditionally (despite it's name) isn't really the query language of graph databases.

Same query in Cypher (the language used by e.g. Neo4J, RedisGraph):

    MATCH (n:Country) WHERE n.population > 1000000 RETURN n.name

aptxkid|4 years ago

How a graph DB index the data to support this query?

3dfan|4 years ago

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.

dreyfan|4 years ago

GraphQL has absolutely nothing to do with graph databases nor SQL databases. It’s a poorly named schema for making RPC calls and designating the response structure.

dreamcompiler|4 years ago

Exactly. GraphQL is merely REST 2.0. That's all it is. Whether it's even an improvement over REST 1.0 is debatable.