<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Arjun Narayan blog]]></title><description><![CDATA[I write about things, mostly databases and distributed systems but also other things in computer science.]]></description><link>https://www.arjunnarayan.com</link><image><url>https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg</url><title>Arjun Narayan blog</title><link>https://www.arjunnarayan.com</link></image><generator>Substack</generator><lastBuildDate>Thu, 16 Apr 2026 23:12:39 GMT</lastBuildDate><atom:link href="https://www.arjunnarayan.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Arjun Narayan]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[arjunnarayan@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[arjunnarayan@substack.com]]></itunes:email><itunes:name><![CDATA[Arjun Narayan]]></itunes:name></itunes:owner><itunes:author><![CDATA[Arjun Narayan]]></itunes:author><googleplay:owner><![CDATA[arjunnarayan@substack.com]]></googleplay:owner><googleplay:email><![CDATA[arjunnarayan@substack.com]]></googleplay:email><googleplay:author><![CDATA[Arjun Narayan]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[The Problem with Lying is Keeping Track of all the Lies]]></title><description><![CDATA[Over on the Materialize blog I wrote a piece on database isolation, and what goes wrong when you have weak isolation.]]></description><link>https://www.arjunnarayan.com/p/the-problem-with-lying-is-keeping</link><guid isPermaLink="false">https://www.arjunnarayan.com/p/the-problem-with-lying-is-keeping</guid><dc:creator><![CDATA[Arjun Narayan]]></dc:creator><pubDate>Wed, 05 Jun 2024 19:58:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Over on the Materialize blog I wrote <a href="https://materialize.com/blog/keeping-track-lies/">a piece on database isolation</a>, and what goes wrong when you have weak isolation.</p>]]></content:encoded></item><item><title><![CDATA[The Uses and Abuses of Cloud Data Warehouses]]></title><description><![CDATA[Over on the Materialize blog, I wrote a piece about what often goes wrong in data infrastructure.]]></description><link>https://www.arjunnarayan.com/p/the-uses-and-abuses-of-cloud-data</link><guid isPermaLink="false">https://www.arjunnarayan.com/p/the-uses-and-abuses-of-cloud-data</guid><dc:creator><![CDATA[Arjun Narayan]]></dc:creator><pubDate>Thu, 27 Jul 2023 19:56:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Over on the Materialize blog, I wrote <a href="https://materialize.com/blog/warehouse-abuse/">a piece</a> about what often goes wrong in data infrastructure. There&#8217;s <a href="https://news.ycombinator.com/item?id=37146532">a discussion</a> on Hacker News as well.</p>]]></content:encoded></item><item><title><![CDATA[Kafka is not a database]]></title><description><![CDATA[Over on the Materialize blog I wrote a post about what Kafka does and doesn't do.]]></description><link>https://www.arjunnarayan.com/p/kafka-is-not-a-database</link><guid isPermaLink="false">https://www.arjunnarayan.com/p/kafka-is-not-a-database</guid><dc:creator><![CDATA[Arjun Narayan]]></dc:creator><pubDate>Tue, 08 Dec 2020 20:53:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Over on the Materialize blog I wrote a post about what Kafka <a href="https://materialize.com/blog/kafka-is-not-a-database/">does and doesn't do</a>.</p>]]></content:encoded></item><item><title><![CDATA[The Philosophy of Computational Complexity ]]></title><description><![CDATA[Has there been progress in philosophy? Yes, in theoretical computer science.]]></description><link>https://www.arjunnarayan.com/p/the-philosophy-of-computational-complexity</link><guid isPermaLink="false">https://www.arjunnarayan.com/p/the-philosophy-of-computational-complexity</guid><pubDate>Sun, 27 May 2018 20:40:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Tyler Cowen asks: <a href="https://archive.is/o/fjkSZ/https://marginalrevolution.com/marginalrevolution/2018/05/has-there-been-progress-in-philosophy.html">Has there been progress in philosophy</a>? He cheats a bit, pointing mainly to progress in science in his 16 answers. Perhaps that is the point.</p><p>Philosophy's successes rapidly create new fields, leaving them only to tackle the new frontier. So over time it appears they've done no work. I am sympathetic to this view, and some AI researcher friends of mine also occasionally feel similarly aggrieved as their successes spawn new fields (search, vision, natural language processing), but they are left hanging the bag marked 'problems on which we've made no progress'.</p><p>I like Tyler's 16 answers (some more than others), but I think there's a 17th significant omission, which is the tremendous advances we've made in our understanding of computational complexity. This is, in my estimation, the field in which we have made the most progress in the past 50 years (the field did not really exist 50 years ago, and it's been 46 years since <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems">Karp's seminal paper</a>). I would go so far as to say that we currently lie on the cusp of a potential scientific revolution, akin to where theoretical physics was in 1899.</p><p>First, computational complexity is not well-understood outside of computer science, and this is a pity. <a href="https://archive.is/o/fjkSZ/https://www.scottaaronson.com/papers/philos.pdf">Philosophers in particular should pay more attention to computational complexity</a>! Second, among its most natural audience - other computer scientists - I've frequently heard expressions of derision pointed in its direction. The sentiment I've heard most is that the basic structure that complexity research gives us is useful (for example we deeply care if we're using an <code>O(n log n)</code> algorithm or an <code>O(n\^2)</code> algorithm in practice), but the more complicated complexity classes are off the rails. The last significant advance we had was in classifying the NP-complete problems. But we KNOW that <code>P!=NP</code>. Why do we need a proof? The final crux of the argument comes from an appeal to that favorite jackass of armchair physicists, <a href="https://archive.is/o/fjkSZ/www.scottaaronson.com/talks/feynman.pptx">Richard Feynman</a>: Feynman apocryphally had trouble understanding why it was an open question at all! As Scott Aaronson has said multiple times, if we were physicists, we would have long declared <code>P!=NP</code> to be a "law of the universe" and moved on<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. But I care. First, because the theory is important as-is. But if you're not swayed by analogy to <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/The_Making_of_the_Atomic_Bomb">the practical consequences of advancements in theoretical physics</a>, I'll give you two solidly practical reason to care. First, all of cryptography depends crucially on our understanding of complexity. Second, <a href="https://archive.is/o/fjkSZ/https://people.csail.mit.edu/costis/simplified.pdf">the computational complexity of markets</a> are a crucial theoretical design criterion, one that has historically been underemphasized in market design, <a href="https://archive.is/o/fjkSZ/https://press.princeton.edu/titles/11222.html">but will increasingly become more relevant as our markets get more computationally complex</a>.</p><h3>P and NP in 2 minutes</h3><p>A brief introduction to the problem at hand: <code>P</code> is the class of problems that have efficient polynomial-time solutions. <code>NP</code> is the class of problems that have efficient polynomial time <em>verifications</em> of correct solutions.</p><p>I'll give you an example: multiplying two numbers together is in <code>P</code>. If you increase the number of digits in my input, I have to do more but not that much more work (strictly speaking, about <code>n\^1.425</code> work), where n is the number of digits in the larger input. <code>n\^1.425</code> is a polynomial, and thus this entire problem is "in polynomial time", <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Toom%E2%80%93Cook_multiplication">the proof is by construction</a>.</p><p>Here's an example of a problem that is in <code>NP</code>: factoring a number. We don't have a constructive algorithm that will give us a number's factors in polynomial time (it is an open question if there is one), but if a genie were to present you with the factors, you can very easily verify if the purported factors are indeed correct, by multiplication. Thus, factoring is in <code>NP</code>.</p><p>Now there are some problems in <code>NP</code> that are "as hard" as all other problems in <code>NP</code>, because a solution can be used to bootstrap solutions to all other <code>NP</code> problems. The classic example is the <a href="https://archive.is/o/fjkSZ/https://simple.wikipedia.org/wiki/Travelling_salesman_problem">traveling salesman problem</a>. If you had a genie that could always solve traveling salesman problems, you can easily translate any other <code>NP</code> problem (such as factoring) into an instance of the traveling salesman problem, give it to your genie, take the resulting solution, and use that to get the factors. We thus call traveling salesman "<code>NP</code> complete". There are a surprisingly <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems">large number of practical problems that are </a><code>NP</code><a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Karp%27s_21_NP-complete_problems"> complete</a>, and identifying a wide set of them basically kicked off this field.</p><p>The question now comes around: Are <code>NP</code>-complete problems solvable in polynomial time? This may seem like a surprising question, because the instinctive answer is "Of course not! Why on Earth would you think it would be so?" But a proof has been surprisingly elusive, and meanwhile, we've built more and more systems that implicitly rely on <code>P!=NP</code>, and its various downstream consequences, so it would be nice to know for sure.</p><h3>The Computational Universe and the Physical Universe</h3><p><code>P!=NP</code> is the biggest open question today, and not just because of the cliched joke that if <code>P=NP</code>, we'd solve the other 5 outstanding <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Millennium_Prize_Problems">Clay Millenium Prize Problems</a>. It's the biggest outstanding question because it has the chance to reveal very fundamental flaws in our entire scaffolding of theoretical understanding of our computational universe. Many different---and currently very plausible---advances to answering the <code>P=NP</code>question could very well be akin to the <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Michelson-Morley_experiment">Michelson-Morley experiment</a>, revealing gigantic flaws in our understanding of the computational universe, just as that experiment pretty much put the kibosh on luminiferous aether<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>. Anyone who confidently asserts that <code>P!=NP</code> is dangerously close to Lord Kelvin's assertion in 1900 that "There is nothing new to be discovered in physics now. All that remains is more and more precise measurement."</p><p>Let me elaborate on where we currently are in our understanding of our computational universe: Over the past fifty years, we've built up our understanding on top of a house of cards, and each year we add another level of cards atop. At the base are a few fundamental open questions on which we have reasonable educated guesses (I will not resist this opportunity to snark back at physicists; these are what physicists would call "laws"). Many of those cards on the top are attempts to collapse the house of cards, and in an attempt at a meta-proof by contradiction, each failed attempt is yet another clue that perhaps the foundation is sound after all.</p><p>But to me, the important insight behind understanding the relevance of the <code>P!=NP</code> problem is that <em>it's not merely a binary question</em>. It's more a question of several different worlds that we could be living in, all of which are distinct and profoundly different.</p><p>As Scott Aaronson lays out in <a href="https://archive.is/o/fjkSZ/https://www.scottaaronson.com/papers/npcomplete.pdf">NP-complete Problems and Physical Reality</a>, questions about the computational nature of our universe are fundamentally questions about the physical nature of our universe. In a sense, the<code>P!=NP</code> question is the heir (in magnitude) to the implied question posed by <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Lorentz_transformation">the Lorentz transformation</a>[5]. An answer to the <code>P!=NP</code> that resolved which of Impagliazzo's worlds we actually lived in would be as impactful as the theory of special relativity. Essentially, the core question of our era is: "<a href="https://archive.is/o/fjkSZ/https://twitter.com/pasiphae_goals/status/923224327247540226">is cryptography possible?</a>"</p><p>Understanding the physical structure of our universe matters because it determines the structure of how we will inhabit the universe. Liu Cixin's <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/The_Dark_Forest">The Dark Forest</a> poses that it is the physical reality of relativistic acceleration that explains the Fermi paradox: since kinetic payloads accelerated to relativistic speeds cannot be detected in advance, preemptive first strikes are the Nash equilibrium strategy. The only winning move is not to play, and stay "dark" in the forest of the universe. I find this solution intriguing enough to be the basis of a science fiction universe, although I am skeptical that this is the universe that we do live in. Many uncertainties remain in the detailsof how decentralized one can make one's communication web, which we do not yet fully understand<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>. Nevertheless, these questions depend very deeply on the exact details of the technological limits our physical universe (e.g. does relativistic acceleration necessarily leave energy signatures that can be traced ex post facto?).</p><p>What is the computational structure of our universe? Given how little we know of our universe, I've found the best way to approach this question is to try to understand five different parallel worlds, first introduced by Russell Impagliazzo in <a href="https://archive.is/o/fjkSZ/https://www.karlin.mff.cuni.cz/%7Ekrajicek/ri5svetu.pdf">A Personal View of Average Case Complexity</a>, each with different computational complexity properties. The core question then becomes: which of these five worlds of Russell Impagliazzo do we live in? He named his five worlds Algorithmica, Heuristica, Pessiland, Minicrypt, and Cryptomania.</p><h3>Algorithmica</h3><p>This is the <code>P=NP</code> world that people typically think of. This is the one where we have a constructive algorithm that efficiently solves <code>NP</code>-hard problems. We use this algorithm to bootstrap answers to the other Clay problems, all of physics and mathematics, and then shortly after, ascend to Godhood as Arthur C. Clarke-esque beings of pure energy without corporeal form. I will not elaborate further on this world, except to note that nobody really believes that this is the world we live in<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a>. Nevertheless, until proven otherwise, this is potentially the world we live in. If we were truly contemplating Algorithmica and Not Algorithmica as binary possibilities, I too would take the Feynman stance. So let's move on to more interesting possibilities.</p><h3>Heuristica</h3><p>The best start to describing this world is to begin by directly quoting Impagliazzo:</p><blockquote><p>Heuristica is the world where <code>NP</code> problems are intractable in the worst-case, but tractable on average for any samplable probability distribution<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a>.</p></blockquote><p>In essence, you have to do an equivalently hard amount of work to <em>find</em> an instance of an <code>NP</code>-hard problem where solving requires super-polynomial time. Thus, <code>NP</code>-hardness is no longer useful to bootstrap cryptographic one-way functions. I like to think of this world as the one in which we realize that "<code>NP</code>-hardness" as a notion is practically useless. In this world, what <em>truly</em> matters is the scaffolding provided by the heuristic analyses themselves. "Is this problem NP hard" becomes replaced with "Is this problem <code>NP</code>-heuristicable". Carrying forward Aaronson's analysis in <a href="https://archive.is/o/fjkSZ/https://www.scottaaronson.com/papers/npcomplete.pdf">NP-complete Problems and Physical Reality</a>, if you have a problem instance that is non-<code>NP</code>-heuristicable, <em>there was probably some underlying computational or physical process that did a "hard" amount of work to generate that problem instance!</em> It is almost certain that in this world, there would be no practical cryptography, as attacker and defender would simply be locked in a computational arms race. It is, of course, possible that cryptographic one-way functions exist in "some other" way than <code>NP</code>-hardness but all of that depends on reifying precisely how the <code>NP</code>-heuristics work. For all practical purposes, in this world, cryptography would revert to the stone age, and we would start over. But there's a silver lining: we would get to efficiently solve all naturally-occuring <code>NP</code>-hard problems that weren't pre-constructed to be hard by well-resourced computational adversaries. This is a fun but dystopian universe: there are no hard problems, but there are also no secrets.</p><h3>Pessiland</h3><p>Impagliazzo names this world as such because it's truly the worst of all worlds. In this world, <code>NP</code>-hard problems exist, <code>NP</code>-hard instances are easy to find and naturally occur everywhere, but finding <em>matched pairs of </em><code>NP</code><em>-hard instances with known easy "keys" is hard</em>. Let's build some intuition using the traveling salesman problem: in this world, TSP is still hard to solve. But it is hard to <em>generate</em> hard instances of TSP with known solutions ("keys"). Whatever process is used to generate the instance while retaining the key ends up selecting for the subset of problems that are <em>not</em> hard to crack. Thus, you cannot bootstrap any cryptographic one-way function using this process<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a>.</p><p>I.E. The universe is full of naturally occuring <code>NP</code>-hard instances (e.g. all of math and physics, all computational modeling problems like traveling salesman, circuit minimization, etc.). But somehow, <em>generating</em> instances of <code>NP</code>-hard problems with known keys is hard. In a sense, the heuristics work very well for instances we generate from known keys, but not for any natural instances from the wild.</p><p>This is a garbage world. We don't get any benefit from solving <code>NP</code>-hard problems that we want to solve, and we don't get any cryptographic benefit from <code>NP</code>-hardness either. In this world the <a href="https://archive.is/o/fjkSZ/https://github.com/Z3Prover/z3">Z3</a> theorem prover still doesn't work well, but now neither does Amazon.com --- all ecommerce today relies upon public-key cryptography to keep our payments secure.</p><h3>Minicrypt</h3><p>Minicrypt is a world where a modest amount of cryptography is possible (hence the "mini"). Specifically, one-way functions exists[6], but public-key cryptography does not<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a>. One-way functions can be used to bootstrap secure channels, but the actual secret generator must be shared over secure channels a priori. This world is well described in Vernor Vinge's <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/A_Fire_Upon_the_Deep">A Fire Upon the Deep</a>. In that universe, the chief trade goods are physically transmitted <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/One-time_pad">one-time pads</a>. These one-time pads are small, but necessary to bootstrap cryptographically secure computation, as public-key cryptography does not exist.</p><p>You can also get a good intuition for this world because it is one that we've speculated at length on due to quantum computers: the discrete logarithm problem (which is the basis for public-key cryptography) <em>is</em>efficiently solvable by quantum computers (which don't exist yet) via Shor's Algorithm. If you imagine a world where we've built quantum computers but we haven't made any advances in devising public-key cryptographic schemes that aren't Shor's Algorithmable, you're in minicrypt.</p><p>However, in this world you could still use quantum cryptography to do non-public-key cryptography, but you'd still have to physically ship the quantum bits to the destination (due to the <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/No-cloning_theorem">no-cloning theorem</a>). So there's a lot of physically shipping around quantum cryptography starter packs. There's a lot of sci fi movies that are essentially set in minicrypt, because you'd have to get the correct quantum bits into the secure mainframe before you can upload the plans for the death star.</p><h3>Cryptomania</h3><p>This is the classic <code>P!=NP</code> world, except we now have proofs that we live in this world, as opposed to just educated guesses. Our house of cards is stabilized, and all our existing theoretical scaffolding is sound. Importantly, we don't live in minicrypt, pessiland, or heuristica.</p><p>That said, there are a couple caveats. To quote Impagliazzo again,</p><blockquote><p>However, blind acceptance of the existence of public key cryptosystems as a de facto complexity axiom is unwarranted. Currently, all known secure public key cryptosystems are based on variants of RSA, Rabin, and Diffie-Hellman cryptosystems. If an efficient way of factoring integers and solving discrete logarithms became known, then not only would the popular public key cryptosystems be broken, but there would be no candidate for a secure public-key cryptosystem, or any real methodology for coming up with such a candidate. There is no theoretical reason why factoring or discrete log should be intractable problems.</p></blockquote><h3>Minicrypt or Cryptomania?</h3><p><a href="https://archive.is/o/fjkSZ/https://blog.computationalcomplexity.org/2004/06/impagliazzos-five-worlds.html">Lance Fortnow says</a> that "most computer scientists would say Cryptomania or Minicrypt". I'll go one further, and put my money where my mouth is: I'll bet you twenty one million bitcoin that we live in Cryptomania or Minicrypt!</p><p>Answering this binary question alone would give us very different worlds. That said, there are other low probability worlds we might live in. Here's one, which I name Polynomia:</p><p>Polynomia: In this world, we have a constructive polynomial time algorithm that solves <code>NP</code>-complete problems, except the exponent is some ridiculously large number so as to render the algorithm practically useless. In this world the house of cards we've built up has collapsed, but in a way that leaves nothing but useless rubble to throw out. We begin the computer-scientific enterprise anew.</p><p>There's a good reason that Impagliazzo doesn't waste time on this world, because it's really not a serious possibility<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a>. I bring it up because it serves as a useful guidepost as to why some people give the Feynman answer of "just declare it a law of physics and move on". If you were to phrase the question as "do we live in Minicrypt/Cryptomania or Polynomia?", the derisive answer is a lot more sympathetic! But as I hope I've made clear today, that's not the actual question.</p><h3>Acknowledgements</h3><p>Thanks to <a href="https://archive.is/o/fjkSZ/justinjaffray.com/">Justin Jaffray</a>, <a href="https://archive.is/o/fjkSZ/https://twitter.com/jcreed">Jason Reed</a>, and <a href="https://archive.is/o/fjkSZ/jgillenw.com/">Jennifer Gillenwater</a> for helpful suggestions to this post. Thank's also to <a href="https://archive.is/o/fjkSZ/https://davmre.github.io/">Dave Moore</a> for suggestions to this post.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Newsflash to my economist friends: physics envy is everywhere, even amongst the current masters of the universe, computer scientists.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>The history of the Lorentz transformation is very interesting: we essentially <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/History_of_Lorentz_transformations%23Special_relativity">had the equations</a> that described the <a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Aberration_of_light">strange behavior of light</a> without understanding why, until the theory of special relativity. The Michelson-Morley experiments were giant WTFs in 1887, which pretty conclusively shot the existing physics theories about luminiferous aether. Special relativity only came around in 1905. For 18 long years, we had no idea what was going on, even after we had the equations to describe it precisely.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Details such as: if you onion route your messages, can you communicate without revealing your true location? If you set up automated retaliation "submarines" that return fire, can you layer a level of mutually assured destruction that returns you to a stable non-first strike equilibrium?</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>In Bill Gasarch's <a href="https://archive.is/o/fjkSZ/www.cs.umd.edu/%7Egasarch/papers/poll.pdf">poll</a> of prominent members of the theoretical research community, we have 9 respondents (out of 100) who said that <code>P=NP</code> would be the result. Of all respondents, 62 left comments. I categorize the following 6 commenters as either supporting a Polynomia view, or posing that <em>if</em> <code>P=NP</code>, it would be because of Polynomia and not Algorithmica: Jamie Andrews, Yuri Gurevich, David Isles, Donald Knuth, Vladik Kreinovich (who in turn cites Levin as the true originator of his position), Clyde Kruskal. I do not have high confidence in my reading of these comments; there's a lot of in-jokes there.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>If your question is why can't I have a uniform distribution over all of the problem inputs that give worst-case complexity? The answer is that the magical Impagliazzo's demon makes sampling from <em>this</em> probability distribution <code>NP</code>-hard, so you're back to putting in large amounts of work to generate instances that require large amounts of work to crack.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p><a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/One-way_function">"One way function"</a> is the standard term in cryptography, but it is poorly named for giving the right intuition. We essentially talk about functions that are easy in two ways if you know a key, but only easy in one direction if you <em>don't</em> know the key. This is useful in cryptography, because you share the decryption key with your buddy, and then freely use the encryption scheme. If someone else gets hold of the encryption scheme, they cannot use it to decipher the decryption key.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>Public key cryptography refers to algorithms that can bootstrap a shared secret key where the participants are only talking over open channels, and have not previously established the shared secret. The classic example is<a href="https://archive.is/o/fjkSZ/https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange">Diffie-Hellman key exchange</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>But maybe I'm wrong! Don Knuth <a href="https://archive.is/o/fjkSZ/www.informit.com/articles/article.aspx?p=2213858&amp;WT.mc_id=Author_Knuth_20Questions">(see question 17)</a> holds the clearest pro-Polynomia view. It's unclear how much of his view is genuinely pro-Polynomia versus a Polynomia-must-be-taken-more-seriously, you underestimate the demons of the shadow at your own peril, etc. etc.</p></div></div>]]></content:encoded></item><item><title><![CDATA[A History of Transaction Histories]]></title><description><![CDATA[I&#8217;ve been trying to understand database transactions for a long time, and recently spent some time researching this with Justin Jaffray. Here&#8217;s an attempt to summarize what we&#8217;ve learned.]]></description><link>https://www.arjunnarayan.com/p/a-history-of-transaction-histories</link><guid isPermaLink="false">https://www.arjunnarayan.com/p/a-history-of-transaction-histories</guid><dc:creator><![CDATA[Arjun Narayan]]></dc:creator><pubDate>Fri, 30 Mar 2018 17:13:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve been trying to understand database transactions for a long time, and recently spent some time researching this with <a href="http://justinjaffray.com/">Justin Jaffray</a>. Here&#8217;s an attempt to summarize what we&#8217;ve learned.</p><p>One recurring challenge has been that understanding transactions has been a decades long journey for the database and distributed infrastructure community. Reading the literature requires understanding this context. Otherwise it&#8217;s jarring to see contradicting terminology, and contradicting intuitions.To clarify this, I&#8217;ve written down how the discourse around database transactions has evolved.</p><p>In the beginning (1990?) database connections were nasty, brutish, and short. Under the law of the jungle, anarchy reigned and programmers had to deal with numerous anomalies. To deal with this, the ANSI SQL-92 standard was the first attempt to bring <a href="http://www.adp-gmbh.ch/ora/misc/isolation_level.html">a uniform definition to isolation levels</a>. They chose the following path:</p><ol><li><p>There are a few known anomalies, namely <a href="https://en.wikipedia.org/wiki/Isolation_(database_systems)%23Dirty_reads">dirty reads</a>, <a href="https://en.wikipedia.org/wiki/Isolation_(database_systems)%23Non-repeatable_reads">non-repeatable reads</a>, and <a href="https://en.wikipedia.org/wiki/Isolation_(database_systems)%23Phantom_reads">phantom reads</a>.</p></li><li><p>They recognized that there are some locking strategies that prohibit some or all of these anomalies. These they called &#8220;read uncommitted&#8221; (the jungle), &#8220;read committed&#8221; (no dirty reads), repeatable read (no dirty reads or non-repeatable reads).</p></li><li><p>The final level of enlightenment was the isolation level that didn&#8217;t have all three anomalies. They called it serializable, but like&#8230; lets just say that was a flaw in this plan.</p></li></ol><p>But serializability is one of the older gods. The definition goes back to the 1960s, and is defined in terms of<em>transaction histories</em>. <a href="https://www.cs.purdue.edu/homes/bb/cs542-11Spr/SCDU-Papa-79.pdf">To quote Christos Papadimitriou</a> from one of the earlier papers that discussed transactions:</p><blockquote><p>A sequence of atomic user updates/retrievals is called serializable essentially if its overall effect is as though the users took turns, in some order, executing each their entire transaction indivisibly.</p></blockquote><p>I personally find reading papers from the era of scanned typewritten sheets hard, so I&#8217;m going to skip ahead and say that <a href="https://cs.brown.edu/%7Emph/HerlihyW90/p463-herlihy.pdf">Herlihy-Wing</a> is a decent place to understand serializability. But the idea is surprisingly simple: every transaction happens as if it happened at some instantaneous point in time, and there&#8217;s some order between them (it doesn&#8217;t even say that this order has to be clear to the users, or to the transactions themselves! It just has ex-post-facto to exist).</p><p>A few years later, folks from Microsoft&#8217;s database group wrote a great paper called <a href="https://www.cs.umb.edu/cs734/CritiqueANSI_Iso.pdf">A Critique of ANSI SQL Isolation Levels</a>, which points out that the ANSI SQL definition of serializable is&#8230; not serializable? Like the way ANSI thinks about it, if you eliminate dirty reads, non-repeatable reads, and phantom reads, you&#8217;re serializable.<strong>This is wrong</strong>. It turns out if you eliminate these three anomalies, what you have is a new isolation level which they called Snapshot Isolation.</p><p>The other valuable contribution of the Critique is to point out that defining isolation in terms of &#8220;the absence of specific anomalous phenomena&#8221; is bad, and like, can we please start talking about transaction histories? The surrounding literature around this time period talks about isolation levels by defining <em>specific locking strategies</em>and then proving that those locking strategies can or cannot have various anomalies. This is confusing, because you can have multiple locking strategies with functionally equivalent isolation levels, but the names are associated with the strategy, and so you have multiple names for the same isolation level.</p><p>In comes a knight on shining armor to clear up this mess: Atul Adya, with his PhD Thesis <a href="http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-786.pdf">Weak Consistency: A Generalized Theory and Optimistic Implementations for Distributed Transactions</a>. Adya starts by looking at transaction histories. His strategy is essentially, &#8220;here are some histories, lets study the graphs&#8221;. Then he identifies various weird shapes in the graphs (honestly, mostly cycles of various lengths?), and says &#8220;these are bad&#8221;. Then he maps each badness back to the ANSI definitions, sort of retroactively giving some coherent mathematical meaning to the ANSI isolation levels. This is very valuable! We finally have precise definitions for isolation levels, ones that are independent of the locking strategy that happens to live at that level!</p><p>But besides just giving meaning to the four ANSI levels, he also identifies other anomalies that are more subtle, e.g. <a href="https://github.com/cockroachdb/cockroach/issues/10030">G2</a>, or &#8220;anti-dependency cycles&#8221; which are very subtle and live in the vast uncharted territory between Snapshot Isolation and Serializability.</p><p>Adya&#8217;s thesis is seminal in databases. It is the first time someone coherently gave mathematical definitions of isolation levels in terms of properties one can observe in a transaction history graph. The year is 1999. Infrastructure still sucks.</p><p>Now the next question comes up: what do we do with all these databases that exist in the wild (namely Oracle and Postgres, MySQL is still a toy around now) that <em>claim</em> serializability but are actually just snapshot isolation, because they were built in a world of ANSI definitions, but now we know better?</p><p><a href="https://pdfs.semanticscholar.org/d658/2728e30011adfe27b329c35203dfb8d1e7a8.pdf">Alan Fekete et al</a> have a great idea in 2005, which they call &#8220;Making Snapshot Isolation Serializable&#8221;. It essentially takes a vanilla snapshot isolation database, and layers on some checks in the SQL statements, to ensure that you have serializability. They use TPC-C as a running example, because it has already been cleverly engineered to always be serializable, even when running on a snapshot isolation database. So like you, the application programmer, even if you are forced to use a Snapshot Isolation database, can get serializability with this One Weird Trick (Anomalies hate him!).</p><p>Now this is a good idea, and Fekete extends this work in 2008 in a paper called <a href="https://cs.nyu.edu/courses/fall09/G22.2434-001/p729-cahill.pdf">Serializable Isolation for Snapshot Databases</a>. This paper basically runs with that idea, except instead of having those checks be written in application code, they do the checks at the database level. So you don&#8217;t have to rip out your transaction processing engine, but you can just layer on another set of checks, and you can make your database serializable. The technique is called SSI (Serializable Snapshot Isolation) because apparently taking two technical definitions and combining them to name a completely new definition is not confusing at all.</p><p>This is such a good idea, that some people decide to <a href="https://drkp.net/papers/ssi-vldb12.pdf">implement it in PostgreSQL</a> and Postgres finally has serializability. The year is 2012. Note that this is not default postgres mode because ANSI says Snapshot (but called Serializable) is sufficient. This is a good point to note that <strong>The ANSI definitions have not been fixed</strong>.</p><p>This strategy is extended in a paper called <a href="https://drive.google.com/file/d/0B9GCVTp_FHJIMjJ2U2t6aGpHLTFUVHFnMTRUbnBwc2pLa1RN/edit?usp=sharing">A Critique of Snapshot Isolation</a> . This paper points out that SSI bootstrapping algorithm can be simplified. To expand, the original SSI algorithm checks for <code>write-write</code> conflicts. Instead, Yabandeh proposes detecting Read-Write conflicts instead. While this requires holding in-memory data structures that have information about the latest timestamp of every read in the database, it has far better <em>concurrency control</em> behavior (for some common workloads), as it never aborts reads. It only ever aborts writes.</p><p>This is also finally the year when people start to wake up and realize they care about serializability, <a href="https://research.google.com/archive/spanner.html">because Jeff Dean said it&#8217;s important</a>. Michael Stonebraker, meanwhile, has been shouting for about 20 years and is very frustrated that people apparently only care when The Very Important Googlers say its important.</p><p>At this point academics have a lot of angst, because now we&#8217;re in this weird zone where</p><ol><li><p>according to the theory, serializability is The Only Way</p></li><li><p>many people use garbage non-serializable databases and&#8230; are basically fine?</p></li><li><p>Therefore, are we just like wasting our time? Does serializability even matter? What are we doing with our lives?</p></li></ol><p>Peter Bailis summarizes this up best in a very fine <a href="http://www.bailis.org/blog/understanding-weak-isolation-is-a-serious-problem/">blog post in 2014</a>. To quote him:</p><blockquote><p>Despite the ubiquity of weak isolation, I haven&#8217;t found a database architect, researcher, or user who&#8217;s been able to offer an explanation of when, and, probably more importantly, why isolation models such as Read Committed are sufficient for correct execution. It&#8217;s reasonably well known that these weak isolation models represent &#8220;ACID in practice,&#8221; but I don&#8217;t think we have any real understanding of how so many applications are seemingly (!?) okay running under them.</p></blockquote><p>The retort is basically: you&#8217;re not always fine, and you&#8217;re going to find out that you&#8217;re not fine when its too late, so don&#8217;t do that. This is not an easy argument to make. It finally starts to catch once people have been burned with NoSQL databases for about a decade.</p>]]></content:encoded></item><item><title><![CDATA[Arjun Narayan]]></title><description><![CDATA[I&#8217;m Arjun Narayan. I&#8217;m an investor, entrepreneur, and computer scientist.]]></description><link>https://www.arjunnarayan.com/p/coming-soon</link><guid isPermaLink="false">https://www.arjunnarayan.com/p/coming-soon</guid><dc:creator><![CDATA[Arjun Narayan]]></dc:creator><pubDate>Tue, 29 Aug 2006 18:50:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Mh2U!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F69625024-7d93-4e98-b399-cb5f4d2e398e_400x400.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Databases</strong></p><p>I co-founded <a href="http://www.materialize.com">Materialize</a>, a database startup, with <a href="https://en.wikipedia.org/wiki/Frank_McSherry">Frank McSherry</a>. I was the founding CEO.</p><p>I worked at Cockroach Labs as a software engineer, working mainly on SQL query execution and performance engineering.</p><p><strong>Computer Science</strong></p><p>I received a PhD in computer science from the University of Pennsylvania. My PhD was on distributed systems that provided differentially private guarantees when processing data across federated security and privacy domains.</p><p>I knew quickly that I didn&#8217;t want to be an academic, nor did I care deeply about privacy, but I found the experience of getting a PhD extremely rewarding. The problems I was solving were contrived, but solving them required leveraging theorem provers, type systems, databases, deterministic runtimes, compilers, and distributed systems. Overall, a fantastic computer science education.</p><p><strong>Investing</strong></p><p>I invest in technical founders at <a href="https://www.amplifypartners.com">Amplify Partners</a>.</p><p><strong>Writing</strong></p><p>I&#8217;ve collected some of my past writings on this blog, and intend to continue such writing from time to time. I expect writing to be infrequent - only when I really feel like I have something unique to add - so expect the burden on your inbox to be occasional.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.arjunnarayan.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.arjunnarayan.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item></channel></rss>