Note that I’m not asking why the relational model is successful; instead, I wonder why almost every implementation of the relational model takes SQL as their input.
Let me explain why I think SQL shouldn’t be successful. As illustrated in an article I shared eariler, the abstraction barrier laid by SQL is so leaky that any serious DBA must examine the query plan of their SQL statements to avoid writing hopelessly inefficient queries. Ultimately, while SQL claims to be a declarative language, contemporary RDBMS’s are far away from being smart enough to deliver that promise, so programmers/DBA still have to process a good understanding of their data and worry about details in the imperative execution of their queries, mostly by “reverse engineering” the query plan they want to craft a SQL statement, or even worse, stirring the SQL until the query plan start looking right.
I’m not an expert in databases, but I have been tortured by SQL recently, and I naively think an imperative DSL for writing queries would help improve the situation. As an extreme example, perhaps an RDBMS can allow programmers to compose query plans explicitly? Surely the initial learning curve would be steep, but getting rid of an unnecessary indirection should boost productivity in the long term. However, I’m not aware of any system like this. It looks like people just use SQL even if it has long become a hairy beast.
So why is SQL so successful despite its shortcoming? I hope this is not a stupid question :)