Comment by mr_toad
7 years ago
> SQL is extremely expressive, it's almost impossible to build something that cannot be expressed in an SQL query.
If that were true, people would build RDBMS’s in SQL.
7 years ago
> SQL is extremely expressive, it's almost impossible to build something that cannot be expressed in an SQL query.
If that were true, people would build RDBMS’s in SQL.
SQL isn't a general purpose language, it's a data query language.
It fulfils its purpose and does it well.
Not true.
Since the addition of SQL/PSM (1996 IIRC) it has become a computationally complete language (procedural like many of the others) with variables and loops and what have you.
That's only true tautologically--i.e., if you decide to constrain "its purpose" to the set of things SQL does well. If you want to do something perfectly reasonable--like programmatically building queries to access data of arbitrary (read "unknown at compile time") schema, you'll find it's quite hard to do this, at least if you care about performance at all. Largely because SQL doesn't compose well.
Optimization requires knowing the schema, and query usage patterns, and data stats - which competent RDBMS engines use to great effect already.
Sounds like you're looking for a magic silver bullet - there's no free lunch in our field though.
Lastly, the comment I was replying to can be paraphrased as "well is SQL is so great why aren't RDBMS' built using SQL, huh?". Which is a ridiculous question since SQL isn't the right tool for that job - its very name tells you that.
If you want to continue arguing against strawmen do it with someone else.
Most of a RDBMS is actually build using SQL. (For example, in PG constraints and foreign keys are done using triggers and SQL Functions.)