I will not teach your Garbage Query Language

  • Transfer

It will be a bit of a rant, but I am really annoyed by the software in which people are trying to invent their own query language. We already have a trillion different ORMs, another trillion databases with their own query language each, and another trillion SaaS products, for access to which you need to master some regular DSL they came up with.

Give me my SQL back. This language is understandable to everyone, there is already since the 70s and during that time managed to become a standard. It is easy to read and can be used by anyone, from business to engineers.

However, instead, I have to study a whole heap of different "garbage query language" because people are still trying to reinvent the wheel.

Let's start with ORM. Their main feature is a reduction in development time. But instead of writing comprehensible to all SQL, I have to study the documentation of a particular ORM in order to figure out how to write my queries for it. In addition, I have to spend time debugging, find out why this ORM translated my query into some monstrous SQL, which combines 17 tables using their full scan. Instead of sticking to standard SQL, where it’s easy enough to talk about efficiency ("try using indexed columns in predicates", "do not overdo it with joines in one query", etc.), I have to deal with an additional muddy layer hides the original SQL query. Ultimately, you’ll be left with higher-level swollen data classes,

Not to mention the fact that there are about five thousand ORMs, so instead of learning SQL, I have to study 34 different ORMs once. This does not mean that people learn ORM, it means that they simply do not learn SQL.

And all these SaaS products. I just picked a few from my company's stack:

What could be worse than dumping data? A data dump that invents its own query language.

To be fair, some of these queries are still SQL-like, or at least claim this role, but with my own quirks that make me drop everything I knew about SQL before. Sometimes to the extent that this past knowledge may be practically useless.

In addition, each database also tries to reinvent the query language. Mongo has its terrible query language , which I never understood, Lucene has its own , etc.

What am I asking? In fact, not much:

  1. Each SaaS product should provide the ability to copy all the data into my own SQL database (in my case Postgresql / Redshift). I do not want to use their DSL. Perhaps the European Union will be able to establish this as the next requirement after the adoption of the directive on open banking services PSD2 .
  2. A 30-year moratorium on the invention of new query languages ​​is needed.
  3. We need to dispel the myth that ORM make the code cleaner. Switch to the side of pure SQL and you will get much simpler and transparent interaction with your database.

That's all. I understand what looks like an old grumbler, but I take this risk on myself.


This post received a sufficient number of views, so it should cause a keen interest among the public. Follow the discussion on Hacker News and comments on Reddit r / programming .

Also popular now: