▲ 39 points
back
7 comments
Good article. Another interesting and fascinating article from Erik is "A co-Relational Model of Data for Large Shared Data Banks" (http://queue.acm.org/detail.cfm?id=1961297).
It strikes me that the monadic model seems to be over-specifying the query in the same way that SQL does. Compare to a datalog query where the compiler can decide in what order to join the tables and how to perform those joins (eg we use a constraint solver to perform all the joins simultaneously). A clever compiler could probably recover the original intention from the monadic query - similar to how an imperative language forces you to totally order all your statements and then the compiler goes to a great deal of effort to figure out whether that ordering was important or arbitrary so it can emit better code.
Mike Pall has a great deal to say about accurately recording and preserving programmer intention to allow better optimisations throughout the stack - http://www.freelists.org/post/luajit/Ramblings-on-languages-... . Similarly, I recall hearing Carmack talking about wanting to separate logic from optimisations because they spend so much effort removing old optimisations when the hardware changes, but I can't find the source anymore :(
SQL does not specify join order. Determining efficient join order based on constraints and statistical distributions of the data is one of the main tasks which a Cost Based Optimizer performs.
Thanks for your thoughts and the link. Would love to hear/read Carmack's thoughts on this in case you stumble over it again.
There are some interesting points in this other article you reference, such as calling out a few of the strengths and weaknesses of the CWA. I'm a bit puzzled by the assertion that SQL has no recursion, since recursive CTE's are part of the ANSI standard and are supported in popular RDBMs such as Oracle and Postgres. Postgres even has writable CTE's, allowing for example Mandlebrot sets to be computed as SQL queries. On the DDL side there are nested tables.
Shame I never got around to replacing the Queue site / app, it's one of the ACM's token CFM/Oracle sites with no caching.
Wheeee 90s tech!
EDIT: oh, it's loading again. It was looking all slashdotted. ;)
I've read Erik's ACM post when it got published and had a hard time understanding what he is talking about at first.
It took me about until now after seeing functional programming and streams in action to grasp the beauty of the concepts behind it.
I also love the clarity behind the sync/async duality (getters/futures & iterables/streams).