DEV Community

Discussion on: GraphQL for PostgreSQL - Why?

 
benbot profile image
Benjamin Botwin

So with postgraphile, specifically, it could either create a graphql schema (not queries) or provide a graphql api with that generated schema.

The dev would need to write their own graphql queries, but depending on the queries and the methods being called in them, postgraphile (the server, not the generated schema alone) would intelligently create speedy SQL queries UNLESS the dev defined specific functions for some kind of queryable data.

Postgraphile will generate query schema definitions for any tables in the schema that you give it access to. It can do that with mutations too, but you'll usually just want to write all of those yourself.

I really encourage you to give it a try with a toy DB, it's tough to explain how impressive it is (or how useful I find it) over comments on a post :(

Thread Thread
 
johanneslichtenberger profile image
Johannes Lichtenberger

I asked specifically because in the future I might want to build something like that for my own data store/storage engine, which however is based on semi-structured data (binary representation of XML and JSON) and which deduplicates the data naturally and stores an index into each revision... might be interesting, as I can map the fetching of the data probably much more easily to efficient storage operations as for complicated XQuery/JSONiq queries (which seems to be even more complicated regarding all the stuff which is possible in comparison with SQL).