<story><title>Rich Hickey: Deconstructing the Database</title><url>https://www.youtube.com/watch?v=Cym4TZwTCNU</url></story><parent_chain></parent_chain><comment><author>saurik</author><text>Watching this talk has so far (I&apos;m halfway through, and now giving up) been very disappointing, primarily because many of the features and implementation details ascribed to &quot;traditional databases&quot; are not true of the common modern SQL databases, and almost none of them are true of PostgreSQL. As an initial trivial example, many database systems allow you to store arrays. In the case of PostgreSQL, you can have quite complex data types, from dictionaries and trees to JSON, or even whatever else you want to come up with, as it is a runtime extensible system.&lt;p&gt;However, it really gets much deeper than these kinds of surface details. As a much more bothersome example that is quite fundamental to the point he seems to be taking with this talk, at about 15:30 he seriously says &quot;in general, that is an update-in-place model&quot;, and then has multiple slides about the problems of this data storage model. Yet, &lt;i&gt;modern databases don&apos;t do this.&lt;/i&gt; Even &lt;i&gt;MySQL&lt;/i&gt; doesn&apos;t do this (anymore). Instead, modern databases use MVCC, which involves storing all historical versions of the data for at least some time; in PostgreSQL, this could be a very long time (when a manual VACUUM occurs; if you want to store things forever, this can be arranged ;P).&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Multiversion_concurrency_control&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Multiversion_concurrency_contro...&lt;/a&gt;&lt;p&gt;This MVCC model thereby directly solves one of the key problems he spends quite a bit of time at the beginning of his talk attempting to motivate: that multiple round-trips to the server are unable to get cohesive state; in actuality, you can easily get consistent state from these multiple queries, as within a single transaction (which, for the record, is very cheap under MVCC if you are just reading things) almost all modern databases (Oracle, PostgreSQL, MySQL...) will give you an immutable snapshot of what the database looked like when you started your transaction. The situation is actually only getting better and more efficient (I recommend looking at PostgreSQL 9.2&apos;s serializable snapshot isolation).&lt;p&gt;At ~20:00, he then describes the storage model he is proposing, and keys in on how important storing time is in a database; the point is also made that storing a timestamp isn&apos;t enough: that the goal should be to store a transaction identifier... but again, this is how PostgreSQL already stores its data: every version (as again: it doesn&apos;t delete data the way Rich believes it does) stores the transaction range that it is valid for. The only difference between existing SQL solutions and Rich&apos;s ideal is that it happens per row instead of per individual field (which could easily be modeled, and is simply less efficient).&lt;p&gt;Now, the point he makes at ~24:00 actually has some merit: that you can&apos;t easily look up this information using the presented interfaces of databases. However, if I wanted to hack that feature into PostgreSQL, it would be quite simple, as the fundamental data model is already what he wants: so much so that the indexes are still indexing the dead data, so I could not only provide a hacked up feature to query the past but I could actually do so efficiently. Talking about transactions is even already simple: you can get the identifier of a transaction using txid_current() (and look up other running transactions if you must using info tables; the aforementioned per-row transaction visibility range is even already accessible as magic xmin and xmax columns on every table).</text></comment>
<story><title>Rich Hickey: Deconstructing the Database</title><url>https://www.youtube.com/watch?v=Cym4TZwTCNU</url></story><parent_chain></parent_chain><comment><author>erikpukinskis</author><text>Fascinating stuff. Some things that came up for me while watching this and the other videos on their site[1]:&lt;p&gt;It&apos;s not Open Source, for anyone who cares about that. It&apos;s interesting how strange it feels to me for infrastructure code to be anything other then Open Source.&lt;p&gt;I&apos;m sort of shocked that the query language is still passing strings, when Hickey made a big deal of how the old database do it that way. I guess for me a query is a data structure that we build programmatically, so why force the developer to collapse it into a string? Maybe because they want to support languages that aren&apos;t expressive enough to do that concisely?&lt;p&gt;[1] &lt;a href=&quot;http://www.datomic.com/videos.html&quot; rel=&quot;nofollow&quot;&gt;http://www.datomic.com/videos.html&lt;/a&gt;</text></comment>