Things I want in a modern relational query language

17 points by calvin


koala

Less opaque query planners

This needs some more elaboration; PostgreSQL's EXPLAIN (like most other EXPLAINs I've seen) has their own terminology, but well, I don't think there's any existing terminology to reuse. I find EXPLAIN understandable once you learn the terminology.


What I want is a dual syntax. Besides a way to write a query as a text string, I want to be able to write queries as structured data, with libraries to manipulate queries in all languages (perhaps by using protobuf or any other similar thing). I want to be able to write:

students = _.select(_.all).from("students")
foreign_students = students.where("foreign", _.eq(True))
to_display = foreign_students.range(30, 40)
result = to_display.execute()

Many ORMs and other libraries to get data out of RDBMSs have something like this, but I want the new query language to be designed so that structured queries are a first-class citizen.

This is quite useful to implement stuff such as CRUD frameworks; you can define things such as "what needs to be displayed in this list view" and then the CRUD framework can manipulate the query to implement pagination and similar things. This is nowadays done through ORMs (which means you often don't have all of the RDBMS features) or by string manipulation (ugly).


Of course, I would also like the classic abbreviated join format inferred from foreign keys (e.g. select * from students.student_address.addresses, where student_address is a foreign key on the addresses table to students).


And it's not really a query language feature, but I want incremental queries. I should be able to subscribe to the results of a query and get streaming updates to it. Real-time UIs are useful and it's really hard to implement them efficiently in current OSS RDBMSs.