<?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[Vagabond Research]]></title><description><![CDATA[code monkey]]></description><link>https://blog.katanaquant.com</link><image><url>https://substackcdn.com/image/fetch/$s_!rIyR!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg</url><title>Vagabond Research</title><link>https://blog.katanaquant.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 12 May 2026 11:40:33 GMT</lastBuildDate><atom:link href="https://blog.katanaquant.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Hōrōshi バガボンド]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[katanaquant@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[katanaquant@substack.com]]></itunes:email><itunes:name><![CDATA[Hōrōshi バガボンド]]></itunes:name></itunes:owner><itunes:author><![CDATA[Hōrōshi バガボンド]]></itunes:author><googleplay:owner><![CDATA[katanaquant@substack.com]]></googleplay:owner><googleplay:email><![CDATA[katanaquant@substack.com]]></googleplay:email><googleplay:author><![CDATA[Hōrōshi バガボンド]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Your Orchestrator Is An Exponential Slop Machine]]></title><description><![CDATA[gstack&#8217;s browser docs promise 0 tokens of context overhead per call.]]></description><link>https://blog.katanaquant.com/p/your-orchestrator-is-an-exponential</link><guid isPermaLink="false">https://blog.katanaquant.com/p/your-orchestrator-is-an-exponential</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Fri, 03 Apr 2026 07:45:12 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!4Nsp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>gstack&#8217;s browser docs promise 0 tokens of context overhead per call.</p><p><em>&#8220;Plain HTTP, plain text, lighter than MCP.&#8221;</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>At the transport layer, maybe that&#8217;s true. At the workflow layer, one <code>/autoplan</code> run expands into at least <code>60,600</code> to <code>103,500</code> tokens before any output.</p><p></p><h2><strong>What are orchestrators anyway?</strong></h2><p>Orchestrators, swarms, agent teams, virtual engineering teams or whatever else people call them, are everywhere right now. Their promise is simple: you keep the human in the loop, wrap the model in more structure, add planning and review for safety, and somehow get software faster without losing rigor.</p><p>There are many examples with <code>gstack</code> being one of them. It is presented as a lightweight local browser-agent stack and as proof that high-velocity AI-assisted development can produce useful engineering workflows.</p><p>People were making fun of <code>garryslist</code>, a public product of <code>gstack</code>. A widely shared third-party audit found a single homepage load pulling <code>169</code> requests and <code>6.42 MB</code> for what is basically a personal blog. That sparked my interest to look under the hood and ask why the end-product felt so bloated.</p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://x.com/Gregorein/status/2038953944475472316?s=20&quot;,&quot;full_text&quot;:&quot;so... I audited Garry's website after he bragged about 37K LOC/day and a 72-day shipping streak.\n\nhere's what 78,400 lines of AI slop code actually looks like in production.\n\na single homepage load of <a class=\&quot;tweet-url\&quot; href=\&quot;http://garryslist.org\&quot;>garryslist.org</a> downloads 6.42 MB across 169 requests.\n\nfor a  https://t.co/GPAeX8fyOl&quot;,&quot;username&quot;:&quot;Gregorein&quot;,&quot;name&quot;:&quot;gregorein&quot;,&quot;profile_image_url&quot;:&quot;https://pbs.substack.com/profile_images/1899959269115531264/q_nPoe8U_normal.jpg&quot;,&quot;date&quot;:&quot;2026-03-31T12:17:56.000Z&quot;,&quot;photos&quot;:[{&quot;img_url&quot;:&quot;https://pbs.substack.com/media/HEvJOO4asAATISw.jpg&quot;,&quot;link_url&quot;:&quot;https://t.co/i0NkfGmhwd&quot;}],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:334,&quot;retweet_count&quot;:600,&quot;like_count&quot;:7427,&quot;impression_count&quot;:2549709,&quot;expanded_url&quot;:null,&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><p>For those that don&#8217;t know me: I&#8217;m a developer who cares about programming as a craft. What bugs me about the current coding-agent hype is that it rewards exactly the instincts decades of coding taught me to resist: more surface area, weaker boundaries, thinner verification, and confidence that has nothing behind it.</p><p>It&#8217;s not as if I never produced my fair share of sloppy code. I did. But then someone else reviewed it or a proper CI/CD path caught it before it shipped.</p><p>The current hype seems to celebrate skipping all of that. And if you object you <em>&#8220;just don&#8217;t get how software gets made now.&#8221;</em></p><p>I can get behind that thought. Software does get made differently now, but I think differently should still mean correctly and with care.</p><p>The browser layer in <code>gstack</code> may be light. The workflow behind it is heavier, less uniform, and less proven than the public surface suggests. Maybe the output is useful. But useful output you can&#8217;t explain is not leverage. It&#8217;s debt. It&#8217;s likely to be unoptimized and bad!</p><p></p><h2><strong>This is supposed to be lightweight</strong></h2><p><code>gstack</code>&#8216;s docs also claim a 20-command session saves <code>30,000-40,000</code> tokens compared to chunkier tool protocols. And at the narrow transport layer, maybe that&#8217;s true.</p><p>But the repo isn&#8217;t pitched as &#8220;a slightly more efficient way to send browser commands.&#8221; It&#8217;s pitched as a software factory with public rhetoric about <code>10-15</code> parallel sprints. Once that is the promise, the question stops being about one HTTP call and starts being about the whole workflow.</p><p></p><h2><strong>The one command context bloat</strong></h2><p><code>/autoplan</code> is sold as &#8220;one command, fully reviewed plan.&#8221; The skill itself is about <code>15.0k</code> tokens under OpenAI&#8217;s <code>o200k_base</code> tokenizer. It explicitly tells the model to read full review skills from disk:</p><ul><li><p><code>/plan-ceo-review</code></p></li><li><p><code>/plan-eng-review</code></p></li><li><p><code>/plan-design-review</code> (when UI scope is detected)</p></li></ul><p>And those review skills can themselves inline <code>/office-hours</code> when no design doc exists, making the problem worse.</p><p>There is no runtime optimization between the skill files and the model. What&#8217;s on disk is what gets sent. No pruning, no compaction, and no token budget that trims content.</p><p>Claude Code&#8217;s own docs recommend keeping skills under <code>500</code> lines. gstack&#8217;s review skills are <code>1,200</code> to <code>1,677</code> lines each, and roughly <code>95%</code> of that is duplicate voice rules, routing, and telemetry. The meat is about <code>50</code> lines per skill.</p><p>So &#8220;one command&#8221; is really a composed prompt path generating around:</p><ul><li><p><code>60.6k</code> when running <code>/autoplan</code> + CEO + ENG</p></li><li><p><code>80.8k</code> when design review is also pulled in</p></li><li><p><code>83.3k</code> when <code>/office-hours</code> gets inlined through the no-design-doc path</p></li><li><p><code>103.5k</code> when both design review and <code>/office-hours</code> are in play</p></li></ul><p>All of that is before the model writes a single token back, and before your own code, plan, or conversation history enters the context.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4Nsp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4Nsp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 424w, https://substackcdn.com/image/fetch/$s_!4Nsp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 848w, https://substackcdn.com/image/fetch/$s_!4Nsp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 1272w, https://substackcdn.com/image/fetch/$s_!4Nsp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4Nsp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png" width="1456" height="1022" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1022,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:118301,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/193041332?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4Nsp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 424w, https://substackcdn.com/image/fetch/$s_!4Nsp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 848w, https://substackcdn.com/image/fetch/$s_!4Nsp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 1272w, https://substackcdn.com/image/fetch/$s_!4Nsp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cffa5e1-7c66-4373-aa4f-15b37ee634b1_2012x1412.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Large prompts alone are not necessarily evidence of bad engineering. But that defense only works if the public story is scoped honestly.</p><p><code>/autoplan</code> is not some weird outlier. The total current-upstream generated skill surface is about <code>407,138</code> tokens plus a shared instruction set that keeps growing with each commit.</p><p>While not every token lands in one flat context window at once, the workflow always loads bloated instructions. Even <code>gstack</code>&#8216;s own internal docs warn that full-skill reads in test fixtures cause context bloat and <code>5-10x</code> slower runs.</p><p></p><h2><strong>That prompt load has a cost</strong></h2><p>Why should anyone care? After all, context windows are getting larger and token prices have fallen since the early GPT-4 era.</p><p>Because bigger windows don&#8217;t make prompt-heavy workflows free. They just raise the ceiling.</p><p>I do not have live <code>gstack</code> billing telemetry, so I am not going to pretend I do. But in my own separate orchestration tooling, built to send small, scoped tasks to isolated, headless agent sessions, the usage dashboard logged <code>839.2M</code> tokens in one month, with peak days above <code>100M</code> tokens. Only for testing the framework across 4-6 small foo projects.</p><p>That might not be direct proof about <code>gstack</code>. But it shows how quickly token burn stops being a rounding error once you start vibe-coding full-time.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yb5F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yb5F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 424w, https://substackcdn.com/image/fetch/$s_!yb5F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 848w, https://substackcdn.com/image/fetch/$s_!yb5F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 1272w, https://substackcdn.com/image/fetch/$s_!yb5F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yb5F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png" width="1456" height="297" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:297,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21871,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/193041332?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yb5F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 424w, https://substackcdn.com/image/fetch/$s_!yb5F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 848w, https://substackcdn.com/image/fetch/$s_!yb5F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 1272w, https://substackcdn.com/image/fetch/$s_!yb5F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa36a0168-e6f9-4696-9240-08a7077120c7_2183x446.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>And that was without all the planning overhead. The repo&#8217;s own public rhetoric about <code>10-15</code> parallel sprints implies tens or hundreds of millions of tokens a month.</p><p></p><h2><strong>It rots too</strong></h2><p>AI-heavy systems don&#8217;t crash loudly. They keep producing output that looks fine while becoming harder to reason about, slower to operate, and more expensive to run.</p><p>Long, layered contexts only make this worse. The more prompt mass you accumulate, the easier it becomes for the important parts to get buried under the rest. Any engineer who has maintained a large system knows the feeling of complexity arriving faster than understanding. That used to be the signal to <em><a href="https://mariozechner.at/posts/2026-03-25-thoughts-on-slowing-the-fuck-down/">&#8220;slow the fuck down&#8221;</a></em> . Now it&#8217;s the signal to add another agent.</p><p><a href="https://arxiv.org/abs/2307.03172">Lost in the Middle</a> found that bigger windows do not guarantee the right information gets used well, and <a href="https://www.trychroma.com/research/context-rot">Context Rot</a> demonstrated that accumulated context can degrade performance while the outputs still look plausible. <a href="https://arxiv.org/abs/2406.00799">Get My Drift</a> also shows that LLMs silently shift task behavior under accumulated external context without observable error signals.</p><p></p><h2><strong>Perpetual maintenance</strong></h2><p><code>gstack</code> is not only growing code. It&#8217;s growing prompts, generated skills, host transforms, and test surfaces around them. This creates a self-reinforcing loop:</p><ol><li><p>add more workflow surface</p></li><li><p>add more scaffolding to manage the surface</p></li><li><p>add more assurance to calm fears about the scaffolding</p></li><li><p>polish it until it looks mature</p></li><li><p>add to the cost of understanding and changing it</p></li></ol><p>It&#8217;s real progress with a carrying cost that stays invisible next to the headline &#8220;look how much leverage this gives me.&#8221;</p><p>In traditional software, degradation shows up in metrics such as latency spikes, error rates and failing tests. In prompt-heavy systems the degradation is more subtle. The output still looks structured. The plan still has sections and the review still sounds thorough. If you don&#8217;t audit the system for quality, the LLM will gladly gaslight you.</p><p>Anthropic&#8217;s own <a href="https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents">harness guidance</a> says long-running agent workflows need runtime visibility into degradation, not just static test coverage. Right now there&#8217;s no way for an ordinary gstack user to tell when context growth starts hurting their results.</p><p></p><h2><strong>But it&#8217;s test-driven!</strong></h2><p>This repo has meaningful tests, CI, and eval infrastructure. But look at what actually runs. The default <code>bun test</code> path does not cover the expensive workflow and cross-host lanes readers are most likely to assume are covered. The broader CI eval surface is real too, just selective:</p><ul><li><p>PR eval workflows cover a selected set of suites</p></li><li><p>periodic eval workflows are real but narrower</p></li><li><p>direct Codex and Gemini suites remain small</p></li></ul><p>The README says &#8220;All 31 skills work across all supported agents.&#8221; On Codex, Review Army is stripped entirely and the <code>/codex</code> skill itself is excluded. Factory Droid is still advertised with setup instructions, but the changelog says support was removed.</p><p>Anthropic&#8217;s own <a href="https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents">guide to agent evals</a> makes the same point: real eval stacks are still partial and task-scoped. They don&#8217;t prove the whole product works.</p><p>I have seen the same pattern in my own codebase audits: plausible code, plausible fixes, plausible tests, plausible benchmarks, plausible docs. Each layer makes the next easier to believe, and confidence does not compound without a human in the loop.</p><p>As an adopter, you are being asked to trust a lot of workflow surface the tests don&#8217;t fully cover. Real enough to trust. Too opaque to verify.</p><p></p><h2><strong>Beyond one repo</strong></h2><p><code>gstack</code> is not presented as a side project. It is used as public proof that high-velocity AI-assisted development works.</p><p>When systems like this get copied, vendored, and adapted, the cost is not only local:</p><ul><li><p>more token spend and slower loops for adopters</p></li><li><p>more maintenance surface for teams that standardize on it: the prompts, the generated skills, the host transforms, the eval harnesses</p></li><li><p>more generated software that looks more mature than it is</p></li><li><p>more verification burden shifted onto downstream users</p></li><li><p>more low-trust surface that somebody else has to filter</p></li></ul><p>There is nothing wrong with exploring these tools and building with them. I do it myself. The problem is what happens when plausibility compounds at every layer and nobody is accountable for the gap between what&#8217;s promised and what&#8217;s shipped.</p><p>The orchestrator produces workflows that look structured. The workflows produce codebases that look tested. The codebases produce software that looks mature. And somewhere downstream an end user trusts something that nobody along the chain actually verified, in a codebase that no human and no model can comfortably reason about anymore because it grew faster than anyone could understand it.</p><p>That is the real cost of the velocity obsession. More commits, more features, more LOC per day, all of it rewarding output volume over the kind of slow, careful accountability that catches the things these systems miss. When the reviewer is a model, the tests are generated, the docs are generated, and the velocity metrics all say green, who is left to ask whether any of it actually works the way the README says it does?</p><p>This is not just about one repo. In <a href="https://substack.com/@katanaquant/note/p-190103552?utm_source=notes-share-action&amp;r=4rsip7">earlier investigations</a> of LLM-generated code, the same pattern kept showing up: plausible output, plausible tests, plausible benchmarks. And a <code>20,171x</code> performance gap hiding underneath. That codebase was itself a product of an orchestration suite with its own prompt packs and skill tokens.</p><p><a href="https://substack.com/@katanaquant/note/p-192726374?utm_source=notes-share-action&amp;r=4rsip7">20K LOC/Day</a> showed <code>15,647</code> (!!) green tests across a codebase where the one measurement that mattered was never written. METR&#8217;s randomized study and GitClear&#8217;s large-scale repository analysis both confirm these patterns are not isolated to any single developer or tool.</p><p>Steve Yegge&#8217;s <a href="https://github.com/gastownhall/gastown">Gastown</a>, another orchestration framework, hit <code>189,000</code> lines in two weeks. Its creator openly says he has never read the code. Users reported <code>$100/hour</code> API burns and auto-merged failing tests. Even Anthropic&#8217;s own Claude Code CLI <a href="https://read.engineerscodex.com/p/diving-into-claude-codes-source-code">leaked at </a><code>512,000</code><a href="https://read.engineerscodex.com/p/diving-into-claude-codes-source-code"> lines</a> and was immediately scrutinized for a single <code>3,167</code>-line function and <code>~250,000</code> wasted API calls per day from a compaction loop that had no retry cap.</p><p>Each time the scale was different: a single function, a full codebase, the orchestrator suite itself. The pattern keeps moving up one level. The buck keeps being passed.</p><p>It&#8217;s your code. It ships under your name. If you can&#8217;t explain what the workflow is doing, how many tokens it&#8217;s burning, and whether the tests actually cover what the README says they cover, then the tooling is not giving you leverage. It&#8217;s giving you plausible deniability.</p><p>The craft hasn&#8217;t changed. Somebody still has to check.</p><p></p><h1><strong>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</strong></h1><p></p><p>Also published on X:</p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://x.com/KatanaLarp/status/2039972757048275045?s=20&quot;,&quot;full_text&quot;:&quot;https://t.co/9Fsm1JmqHm&quot;,&quot;username&quot;:&quot;KatanaLarp&quot;,&quot;name&quot;:&quot;H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;&quot;,&quot;profile_image_url&quot;:&quot;https://pbs.substack.com/profile_images/1767138400442646528/oy1G8fJP_normal.jpg&quot;,&quot;date&quot;:&quot;2026-04-03T07:46:20.000Z&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:1,&quot;retweet_count&quot;:0,&quot;like_count&quot;:0,&quot;impression_count&quot;:10,&quot;expanded_url&quot;:null,&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><p></p><h2><strong>Sources</strong></h2><h3><strong>Primary Evidence</strong></h3><ul><li><p><a href="https://github.com/nichochar/gstack">gstack</a> repository, current upstream at commit <code>6169273</code>. Token measurements use OpenAI&#8217;s <code>o200k_base</code> tokenizer against current-upstream generated <code>SKILL.md</code> files. No runtime pruning verified via <code>scripts/gen-skill-docs.ts</code> generation pipeline analysis.</p></li><li><p><a href="https://code.claude.com/docs/en/skills">Claude Code Skills Documentation.</a> Anthropic. Official skill format specification recommending skills under 500 lines.</p></li></ul><h3><strong>Primary Research &#8212; Long Context &amp; Agent Degradation</strong></h3><ul><li><p>Liu, N. et al. <a href="https://arxiv.org/abs/2307.03172">&#8220;Lost in the Middle: How Language Models Use Long Contexts.&#8221;</a> arXiv, 2023.</p></li><li><p><a href="https://www.trychroma.com/research/context-rot">&#8220;Context Rot: How Increasing Input Tokens Impacts LLM Performance.&#8221;</a> Chroma Research, 2025.</p></li><li><p>Arditi, S. et al. <a href="https://arxiv.org/abs/2406.00799">&#8220;Get My Drift? Catching LLM Task Drift with Activation Deltas.&#8221;</a> arXiv, 2024.</p></li></ul><h3><strong>Primary Research &#8212; Code &amp; Productivity</strong></h3><ul><li><p>METR. <a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">&#8220;Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity.&#8221;</a> July 2025.</p></li><li><p>GitClear. <a href="https://www.gitclear.com/ai_assistant_code_quality_2025_research">&#8220;AI Code Quality Research 2025.&#8221;</a> 2025.</p></li></ul><h3><strong>Industry Commentary &amp; Engineering Guides</strong></h3><ul><li><p><a href="https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents">&#8220;Demystifying Evals for AI Agents.&#8221;</a> Anthropic Engineering, 2025.</p></li><li><p><a href="https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents">&#8220;Effective Harnesses for Long-Running Agents.&#8221;</a> Anthropic Engineering, 2025.</p></li><li><p>Zechner, M. <a href="https://mariozechner.at/posts/2026-03-25-thoughts-on-slowing-the-fuck-down/">&#8220;Thoughts on Slowing the Fuck Down.&#8221;</a> March 2026.</p></li></ul><h3><strong>Third-Party Audits &amp; Case Studies</strong></h3><ul><li><p>@Gregorein. <a href="https://x.com/Gregorein/status/2038953944475472316">garryslist.org homepage audit thread.</a> X/Twitter, March 2026.</p></li><li><p><a href="https://read.engineerscodex.com/p/diving-into-claude-codes-source-code">&#8220;Diving into Claude Code&#8217;s Source Code Leak.&#8221;</a> Engineers Codex, March 2026.</p></li></ul><h3><strong>Prior Articles in This Series</strong></h3><ul><li><p><a href="https://substack.com/@katanaquant/note/p-190103552?utm_source=notes-share-action&amp;r=4rsip7">&#8220;Your LLM Doesn&#8217;t Write Correct Code. It Writes Plausible Code.&#8221;</a></p></li><li><p><a href="https://substack.com/@katanaquant/note/p-192726374?utm_source=notes-share-action&amp;r=4rsip7">&#8220;20K LOC/Day Won&#8217;t Save You.&#8221;</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[20K LOC/Day Won’t Save You. They’ll Just Stack Plausibility.]]></title><description><![CDATA[3.9x faster writes than SQLite via multithreading with &#8220;mathematical near-impossibility of data corruption&#8221;]]></description><link>https://blog.katanaquant.com/p/20k-locday-wont-save-you-theyll-just</link><guid isPermaLink="false">https://blog.katanaquant.com/p/20k-locday-wont-save-you-theyll-just</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Tue, 31 Mar 2026 13:28:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Rn-V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>3.9x faster writes than SQLite via multithreading with <em>&#8220;mathematical near-impossibility of data corruption&#8221;</em></p><p><em>&#8220;Thesis proven.&#8221;</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>The most notorious limitation of SQLite, its single-writer bottleneck, finally solved.</p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://x.com/doodlestein/status/2035063908759654704&quot;,&quot;full_text&quot;:&quot;Making some serious performance strides on FrankenSQLite in the case of multiple concurrent writers.\n\nNormally I just have a bunch of independent agents running and executing beads, but for this I leaned more on my ntm tool to have Claude Code direct a swarm of 6 Claude Codes. &quot;,&quot;username&quot;:&quot;doodlestein&quot;,&quot;name&quot;:&quot;Jeffrey Emanuel&quot;,&quot;profile_image_url&quot;:&quot;https://pbs.substack.com/profile_images/1225476100547063809/53jSWs7z_normal.jpg&quot;,&quot;date&quot;:&quot;2026-03-20T18:40:20.000Z&quot;,&quot;photos&quot;:[{&quot;img_url&quot;:&quot;https://pbs.substack.com/media/HD3_MMKboAA1tBE.jpg&quot;,&quot;link_url&quot;:&quot;https://t.co/48ncR4Hbdo&quot;},{&quot;img_url&quot;:&quot;https://pbs.substack.com/media/HD3_Y2WW0AAdllA.jpg&quot;,&quot;link_url&quot;:&quot;https://t.co/48ncR4Hbdo&quot;}],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:5,&quot;retweet_count&quot;:3,&quot;like_count&quot;:85,&quot;impression_count&quot;:6670,&quot;expanded_url&quot;:null,&quot;video_url&quot;:null,&quot;belowTheFold&quot;:false}" data-component-name="Twitter2ToDOM"></div><p>Or is it?</p><p>TL;DR: Not really. It just appears that way!</p><p>What&#8217;s actually behind it is a Rust rewrite that is, despite the effort of adding 20,000 lines of code a day, still ~1,000x slower than SQLite because it&#8217;s paying for a concurrency feature that doesn&#8217;t actually fire.</p><p>LLMs don&#8217;t just write <a href="https://open.substack.com/pub/katanaquant/p/your-llm-doesnt-write-correct-code?utm_campaign=post-expanded-share&amp;utm_medium=web">plausible code</a>. They write plausible fixes, plausible benchmarks and plausible test suites too, stacking layers of plausibility, each inheriting the confidence of the layer above and the untested assumptions of the layer below.</p><p>If you read my <a href="https://open.substack.com/pub/katanaquant/p/your-llm-doesnt-write-correct-code?utm_campaign=post-expanded-share&amp;utm_medium=web">last article about plausibility</a>, the same rules apply here: I use these tools myself as a practitioner and this isn&#8217;t about one individual developer. It&#8217;s about a <a href="https://open.substack.com/pub/katanaquant/p/your-llm-doesnt-write-correct-code?utm_campaign=post-expanded-share&amp;utm_medium=web">widely observed</a> pattern I think we&#8217;ll all see more of in the future. A reader called this kind of project <em>&#8220;a canary in the software engineering mines&#8221;</em> or something like that (can&#8217;t find it anymore), which I really liked. I appreciate the canary! I think we all should.</p><p>The rewrite keeps getting advertised as <em>the</em> SQLite killer so I thought I&#8217;d have another look. How did 3.9x faster become ~1,000x slower? I followed the claim through the benchmark, the project&#8217;s concurrency mode and the layers underneath.</p><div><hr></div><h2><strong>The &#8220;Only Benchmark That Matters&#8221;</strong></h2><p>I compiled and ran the <a href="https://github.com/brianfrankcooper/YCSB">YCSB-A</a> benchmark, a standard database throughput benchmark, against SQLite and the Rust rewrite&#8217;s C API library. One shared table, 50/50 read/write split:</p><p><em>The benchmark source is available in <a href="https://github.com/KatanaQuant/db_bench_foo">this repository</a> so you can reproduce it yourself. Absolute timings vary with system load and hardware. Ratios are what matter.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BwHX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BwHX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 424w, https://substackcdn.com/image/fetch/$s_!BwHX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 848w, https://substackcdn.com/image/fetch/$s_!BwHX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 1272w, https://substackcdn.com/image/fetch/$s_!BwHX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BwHX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png" width="1057" height="512" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:512,&quot;width&quot;:1057,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:55855,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BwHX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 424w, https://substackcdn.com/image/fetch/$s_!BwHX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 848w, https://substackcdn.com/image/fetch/$s_!BwHX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 1272w, https://substackcdn.com/image/fetch/$s_!BwHX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ab95628-222f-4f37-a9b4-1fcf37cf9031_1057x512.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;d say with 10 ops/s at one thread the rewrite isn&#8217;t really competitive. Tho the more interesting part lies in the multi-thread columns. Those are the ones the original post claimed to outperform by ~4x.</p><p>If it&#8217;s ~1,000x slower on two threads, how did the LLM come up with ~4x faster, claiming success?</p><p>Luckily the upstream repo includes <a href="https://github.com/Dicklesworthstone/frankensqlite/blob/main/crates/fsqlite-e2e/benches/concurrent_write_persistent_bench.rs">their own benchmark</a>, so I checked what&#8217;s happening inside. Three things jump out:</p><ul><li><p><strong>Each thread writes to its own table.</strong> Thread 0 into <code>bench_0</code>, thread 1 into <code>bench_1</code>, etc. They never touch the same data. On its own, I&#8217;d call that fine for a micro-benchmark. But MVCC, the primary feature in the project&#8217;s README, exists so that multiple transactions can work with the same data without blocking each other. If two writers touch the same row, one of them gets stopped and retried. If they never compete, there&#8217;s nothing concurrent going on.</p></li><li><p><strong>SQLite gets forced into </strong><code>BEGIN IMMEDIATE</code>, a <a href="https://www.sqlite.org/lang_transaction.html">more aggressive locking mode</a> than the default <code>DEFERRED</code>. <code>BEGIN IMMEDIATE</code> is the recommended approach for concurrent write-heavy work to avoid conflicts, but that&#8217;s not what&#8217;s being benchmarked here. There is no concurrency, only I/O parallelism across different tables.</p></li><li><p>On top of that, <strong>every single row is its own transaction</strong>. This maximizes the overhead penalty SQLite has to pay per commit. 1,000 rows mean 1,000 commits. Real world databases batch hundreds or even thousands of rows per transaction. That&#8217;s what transactions are for! Paying the overhead cost without using its main feature defeats the entire purpose of transactions.</p></li></ul><p>The benchmark is plausible: it runs and produces numbers. It even looks professional. It just doesn&#8217;t test what the README advertises and the post claims.</p><p>Brendan Gregg describes this anti-pattern in <a href="https://www.amazon.com/Systems-Performance-Brendan-Gregg/dp/0136820158?crid=10TNNY8LM62OY&amp;sprefix=systems+performanc%2Caps%2C227&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=ec85433663601cf57ac010116633eae6&amp;language=en_US&amp;ref_=as_li_ss_tl">Systems Performance</a> as the <em>streetlight anti-method</em>: analyzing with the tools you have rather than the tools the problem requires. The benchmark tested what was easy to measure (parallel I/O to separate tables) and avoided what was hard to measure (concurrent writes to shared data).</p><p>Or as Goodhart&#8217;s Law puts it: <em>when a measure becomes a target, it ceases to be a measure.</em> The 3.9x became the target. The only angle where that proof was possible for the LLM was a combination of separate tables, forced <code>IMMEDIATE</code> locking and single-row transactions. Any other combination would&#8217;ve shown the opposite.</p><p>After discovering that concurrency via MVCC wasn&#8217;t getting benchmarked, I gave SQLite the same parallel setup with one db file per thread for a fair head-to-head comparison:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WJdk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WJdk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 424w, https://substackcdn.com/image/fetch/$s_!WJdk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 848w, https://substackcdn.com/image/fetch/$s_!WJdk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 1272w, https://substackcdn.com/image/fetch/$s_!WJdk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WJdk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png" width="1007" height="365" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:365,&quot;width&quot;:1007,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48873,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WJdk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 424w, https://substackcdn.com/image/fetch/$s_!WJdk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 848w, https://substackcdn.com/image/fetch/$s_!WJdk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 1272w, https://substackcdn.com/image/fetch/$s_!WJdk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9fbd2ca-715e-4989-82c0-9f3f47eb9752_1007x365.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Even then, the rewrite is 3-5x slower. The ~4x advantage in their benchmark didn&#8217;t come from MVCC being fast. It came from finding the one configuration that artificially inflated SQLite&#8217;s bottleneck while not even measuring the thing being advertised anymore.</p><p><strong>If you ask an LLM to write a benchmark that should prove you&#8217;re faster than SQLite, it&#8217;ll find one. But that doesn&#8217;t mean it makes sense!</strong></p><p>If your workload truly has zero contention, with each writer on different data, you don&#8217;t need MVCC at all. <a href="https://turso.tech/blog/give-each-of-your-users-their-own-sqlite-database-b74445f4">Separate SQLite files</a> give you 3-5x more throughput, zero complexity and SQLite&#8217;s full test suite behind it.</p><p>What about all the cases where you DO need MVCC tho? It&#8217;s probably okay to pay the concurrency overhead for a guarantee of zero data loss, right?!</p><div><hr></div><h2><strong>Zero Aborts, Zero Concurrency</strong></h2><p>The project&#8217;s README promises <em>&#8220;Serializable Snapshot Isolation preventing write skew by default.&#8221;</em> This basically just means that when two transactions touch the same row, the database stops one of them and retries it later so it doesn&#8217;t act on stale data. After the first one finishes, the row is updated and the second one can continue. Otherwise you could get race conditions like exceeding an account&#8217;s balance when withdrawing at the same time.</p><p>To test whether the conflict detection actually fires, I ran an <a href="https://github.com/jepsen-io/elle">Elle</a>-style isolation test: four threads withdrawing 100 from five shared accounts with a total balance of 1,000 whenever the balance allowed it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eGkl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eGkl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 424w, https://substackcdn.com/image/fetch/$s_!eGkl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 848w, https://substackcdn.com/image/fetch/$s_!eGkl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 1272w, https://substackcdn.com/image/fetch/$s_!eGkl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eGkl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png" width="962" height="311" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ca05134-811c-419f-8952-96cb3e132388_962x311.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:311,&quot;width&quot;:962,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36716,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eGkl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 424w, https://substackcdn.com/image/fetch/$s_!eGkl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 848w, https://substackcdn.com/image/fetch/$s_!eGkl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 1272w, https://substackcdn.com/image/fetch/$s_!eGkl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca05134-811c-419f-8952-96cb3e132388_962x311.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Sure enough, there were no negative withdrawals. But if you look closely at that table, there were also no aborts? PostgreSQL caught 26 conflicts while the Rust rewrite caught 0.</p><p>If SSI is running, there HAVE to be aborts! Zero aborts means either nobody competed for the same data or the conflict detection isn&#8217;t firing. The SSI code is there (I checked). It also checks for the right things. But a zero on shared data means something else is going on.</p><p>So I used a very simple test to see if concurrency is even used here: four threads, each doing a write transaction and then waiting 100ms. If Multi-Version Concurrency Control is doing its job, all of them should converge on finishing within about 100ms. If they&#8217;re serialized, it&#8217;ll take 400ms.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vnLe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vnLe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 424w, https://substackcdn.com/image/fetch/$s_!vnLe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 848w, https://substackcdn.com/image/fetch/$s_!vnLe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 1272w, https://substackcdn.com/image/fetch/$s_!vnLe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vnLe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png" width="1256" height="218" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/afee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:218,&quot;width&quot;:1256,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35394,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vnLe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 424w, https://substackcdn.com/image/fetch/$s_!vnLe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 848w, https://substackcdn.com/image/fetch/$s_!vnLe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 1272w, https://substackcdn.com/image/fetch/$s_!vnLe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fafee1046-d1cc-4f58-a77b-5dcb1d924e94_1256x218.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Both variants, the sequential and the concurrent one, finish in the same 400ms. They behave the exact same way! This means both are fully serialized.</p><p>The reason for this is that FrankenSQLite&#8217;s pager, which manages all access to data on disk, sits behind a single global mutex. Only one thread goes through the mutex at a time, making all the others wait.</p><p>Kleppmann describes this approach in <a href="https://www.amazon.com/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1098119061?crid=34R4KG2YJ8JZY&amp;sprefix=kleppman%2Caps%2C213&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=9964b61faac513dced84c8d9e906b791&amp;language=en_US&amp;ref_=as_li_ss_tl">Designing Data-Intensive Applications</a>: <em>&#8220;The simplest way of avoiding concurrency problems is to remove the concurrency entirely: to execute only one transaction at a time, in serial order, on a single thread.&#8221;</em></p><p>There is no concurrency here.</p><p><strong>BUT</strong> there is an MVCC layer sitting above the mutex, which does real work: it creates snapshots, tracks versions and builds conflict detection graphs. Every time it needs to actually touch data, it queues behind the same lock as everyone else.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lluL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lluL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 424w, https://substackcdn.com/image/fetch/$s_!lluL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 848w, https://substackcdn.com/image/fetch/$s_!lluL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 1272w, https://substackcdn.com/image/fetch/$s_!lluL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lluL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png" width="1037" height="236" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:236,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28620,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lluL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 424w, https://substackcdn.com/image/fetch/$s_!lluL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 848w, https://substackcdn.com/image/fetch/$s_!lluL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 1272w, https://substackcdn.com/image/fetch/$s_!lluL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7e82568-9d44-4fba-9113-a2660c4dfcf0_1037x236.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The concurrency model can&#8217;t provide concurrency because the storage layer underneath won&#8217;t let it. You&#8217;re paying a 150x penalty for a feature that the mutex makes architecturally impossible to deliver. This is what a gap between layers looks like: the MVCC layer works, the pager layer works, the connection between them doesn&#8217;t.</p><p>The README itself contains a general caveat: <em>&#8220;This README describes the target end-state architecture. The runnable code today is in a hybrid state.&#8221;</em> Fair enough.</p><p>But the same README, in the same &#8220;Current Implementation Status&#8221; section, states: <em>&#8220;fsqlite-vfs, fsqlite-pager, fsqlite-wal, fsqlite-mvcc, and fsqlite-btree are wired into default runtime execution.&#8221;</em> The feature comparison table says <em>&#8220;Concurrent writers: Many (page-level MVCC with SSI).&#8221;</em> No asterisk or &#8220;planned.&#8221; It uses present tense. The caveat is scoped to &#8220;Native mode / ECS sections.&#8221; The concurrency claims are on the live side of that line.</p><p>A common response to my last article was <em>&#8220;it&#8217;s not done yet&#8221;</em> and again it might be tempting to say <em>&#8220;just fix the concurrency and it&#8217;ll work.&#8221;</em> And sure, software is always in progress. That&#8217;s exactly why &#8220;thesis proven&#8221; is the claim that needs the second measurement! The benchmark screenshot says 3.9x. The overlap test says 408ms. One of them measured a layer. The other measured a connection. The README&#8217;s own status section claims the MVCC stack is wired. My overlap test shows it isn&#8217;t.</p><p>The gap isn&#8217;t between &#8220;done&#8221; and &#8220;not done.&#8221; It&#8217;s between what&#8217;s claimed and what&#8217;s connected.</p><div><hr></div><h2><strong>The Layers of Plausibility</strong></h2><p>The project&#8217;s test suite has 15,647 tests. A file called <code>ssi_write_skew.rs</code> tests the exact scenario I just ran and passes. <code>correctness_concurrent_writes.rs</code> contains a comment reading: <em>&#8220;MVCC concurrent writer path is not yet wired.&#8221;</em> The tests for it pass anyway. The tests validate each layer in isolation, where the code IS correct. They don&#8217;t test across the layers where it breaks.</p><p>And it&#8217;s not just the concurrency stack. The <code>JOIN</code> planner crashes at 12.3 GB of RAM on 375 rows, the C API exports only 19 of SQLite&#8217;s 220 functions. The pattern of plausible layers with untested connections runs through the entire project.</p><p>Steve Freeman and Nat Pryce argue in <a href="https://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627?crid=YLJ7NM9XLH08&amp;sprefix=growing+object-oriented+software%2Caps%2C195&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=bfc7d79986c3206a9521d5c76f0207e7&amp;language=en_US&amp;ref_=as_li_ss_tl">Growing Object-Oriented Software</a> that tests exist to surface failures, not to confirm success. 15,647 tests that all pass. None of them fail where it matters: at the boundary between layers.</p><p>Frederick Brooks called these &#8220;the most pernicious and subtle bugs&#8221; back in 1975: system bugs arising from mismatched assumptions made by the authors of various components. Each layer of FrankenSQLite&#8217;s concurrency stack assumes the one below it works. None of them check.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Rn-V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Rn-V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 424w, https://substackcdn.com/image/fetch/$s_!Rn-V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 848w, https://substackcdn.com/image/fetch/$s_!Rn-V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 1272w, https://substackcdn.com/image/fetch/$s_!Rn-V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Rn-V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png" width="1007" height="797" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:797,&quot;width&quot;:1007,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56658,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Rn-V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 424w, https://substackcdn.com/image/fetch/$s_!Rn-V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 848w, https://substackcdn.com/image/fetch/$s_!Rn-V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 1272w, https://substackcdn.com/image/fetch/$s_!Rn-V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7026ead3-9f62-4f6f-be8c-1924053a26e4_1007x797.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The same pattern from my <a href="https://open.substack.com/pub/katanaquant/p/your-llm-doesnt-write-correct-code?utm_campaign=post-expanded-share&amp;utm_medium=web">last plausibility article</a> is at work here. If you read it top-down, everything looks correct: a mutex managing access, SSI detecting conflicts, transactions with proper isolation and a benchmark showing 3.9x. Again, the modules have the right names, the architecture makes sense and the tests pass.</p><p>Bottom-up, none of it connects. The claim comes from an invalid benchmark that validates a feature adding 150x overhead without doing what it promises. It can&#8217;t detect conflicts because the mutex above it serializes everything. All this work only for the mutex to provide isolation the same way SQLite does: by not allowing concurrency at all.</p><pre><code><code>=== Building and running fsqlite-mvcc tests (SSI anomaly) ===
     Running unittests src/lib.rs (target/release/deps/fsqlite_mvcc-285cac5b642bd309)

running 24 tests
[...]
test ssi_anomaly_tests::ssi_anomaly_write_skew_detected ... ok
test ssi_anomaly_tests::ssi_anomaly_phantom_insert_detected ... ok
[...]

test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 1212 filtered out; finished in 2.51s
</code></code></pre><p>To be fair, some things did get better since the last article. On the single-threaded micro-benchmark, the path improved from 20,171x slower to about 9x. The WAL (write-ahead log) sync path was fixed, page copies were reduced and frame assembly was optimized. That&#8217;s real engineering! The things that got measured in response got better. Credit where it&#8217;s due.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KQAr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KQAr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 424w, https://substackcdn.com/image/fetch/$s_!KQAr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 848w, https://substackcdn.com/image/fetch/$s_!KQAr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 1272w, https://substackcdn.com/image/fetch/$s_!KQAr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KQAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png" width="820" height="457" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:457,&quot;width&quot;:820,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50269,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KQAr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 424w, https://substackcdn.com/image/fetch/$s_!KQAr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 848w, https://substackcdn.com/image/fetch/$s_!KQAr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 1272w, https://substackcdn.com/image/fetch/$s_!KQAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6911e3ff-5381-4c9e-b8a4-06c4147d65a8_820x457.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But the concurrency path, the one validated by the rigged benchmark, got worse. The 150x overhead wasn&#8217;t there before. It was added by enabling MVCC on every query without ever testing whether the concurrency it provides actually works. The measured path improved while the unmeasured path accumulated overhead.</p><p>For the ones thinking <em>&#8220;it&#8217;s all refactorable, just replace the mutex and wire the layers.&#8221;</em> Yes, probably. But you don&#8217;t refactor what you don&#8217;t know is broken. The SSI tests pass and the benchmark shows 3.9x. Every signal says green. The overlap test that would reveal the truth doesn&#8217;t exist in the repo because nothing suggested it was needed. That&#8217;s what plausible layers do: they don&#8217;t just hide bugs from reviewers, they hide them from the developer too.</p><p>During my <a href="https://open.substack.com/pub/katanaquant/p/ai-does-not-replace-developers-it?utm_campaign=post-expanded-share&amp;utm_medium=web">own experiment</a> with this codebase, where I tried improving its performance by only prompting, there was a moment where the LLM produced a benchmark showing <code>INSERT</code> at 0.70x, faster than SQLite. My first reaction wasn&#8217;t to celebrate but to stop and ask <em>what&#8217;s wrong.</em></p><p>Turns out the LLM had silently batched 64 autocommit statements into one transaction, changing the durability guarantee. When I asked it about the speed increase directly, it admitted: <em>&#8220;This is cheating.&#8221;</em></p><p>The LLM&#8217;s own reply called it cheating. It just didn&#8217;t volunteer that until asked directly. The 3.9x benchmark has the same structure: it measures something real, just not the thing being claimed.</p><p>So what does it look like when concurrent writes actually work?</p><div><hr></div><h2><strong>How Concurrency Layers Actually Work</strong></h2><p>PostgreSQL has had working Serializable Snapshot Isolation since 2011. The FrankenSQLite spec document even <a href="https://www.drkp.net/papers/ssi-vldb12.pdf">cites the Ports and Grittner paper</a> that documented it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yyTl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yyTl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 424w, https://substackcdn.com/image/fetch/$s_!yyTl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 848w, https://substackcdn.com/image/fetch/$s_!yyTl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 1272w, https://substackcdn.com/image/fetch/$s_!yyTl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yyTl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png" width="1007" height="365" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:365,&quot;width&quot;:1007,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37629,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/192726374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yyTl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 424w, https://substackcdn.com/image/fetch/$s_!yyTl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 848w, https://substackcdn.com/image/fetch/$s_!yyTl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 1272w, https://substackcdn.com/image/fetch/$s_!yyTl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F51d7d76c-1c14-4d2d-b77a-c5884028d66b_1007x365.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Even though FrankenSQLite runs in-process with zero network cost, PostgreSQL, a server where every query pays a network round-trip, is still 188x faster at 1 thread.</p><p>Three deliberate engineering choices explain the gap:</p><ul><li><p>PostgreSQL <strong>doesn&#8217;t funnel all page access through one lock</strong>. It uses per-page lightweight locks so transactions on different pages proceed in parallel. FrankenSQLite has a single <code>Arc&lt;Mutex&gt;</code> for the entire pager.</p></li><li><p>In PostgreSQL <strong>transactions overlap by design</strong>. <code>BEGIN</code> grabs a snapshot without holding a lock. Only <code>COMMIT</code> briefly validates and serializes. My overlap test showed FrankenSQLite takes 400ms for what should take 100 because nothing overlapped.</p></li><li><p>PostgreSQL <strong>pays for serializability in aborts</strong>. 253 at 4 threads, 1,797 at 8. That&#8217;s the cost of actually checking whether two transactions stepped on each other. FrankenSQLite pays 150x overhead and checks nothing.</p></li></ul><p>Each of these is a connection between layers that PostgreSQL tests and FrankenSQLite doesn&#8217;t. Locks connect the pager to concurrent access. Overlap connects transactions to the scheduler. Aborts connect SSI to the commit path. In FrankenSQLite, every one of these connections is missing while every individual layer passes its own tests.</p><div><hr></div><h2><strong>Confidence Outruns Evidence</strong></h2><p>Speed builds plausible layers. Plausible layers hide the gaps. Hidden gaps don&#8217;t get tested. Untested gaps don&#8217;t get refactored. And the system ships with metrics that say it works.</p><p>20,000 lines a day over hundreds of commits in weeks, and only a handful about performance. The debt accumulated faster than anyone could evaluate it. Every layer was plausible. Every test passed. Every metric said green. And the one measurement that mattered - do the layers actually connect - was never written because every signal said it wasn&#8217;t needed.</p><p>Domain knowledge is key. I wrote about this in <a href="https://open.substack.com/pub/katanaquant/p/the-bug-that-shipped?utm_campaign=post-expanded-share&amp;utm_medium=web">The Bug That Shipped</a>: the LLM knows about the bugs. It just doesn&#8217;t volunteer the information unless you ask the right question. And knowing which question to ask is the part that can&#8217;t be automated. You need to know that zero aborts on contended data is wrong. You need to know that &#8220;faster than SQLite&#8221;, a 25-year-old codebase, means something changed that shouldn&#8217;t have.</p><p>My <a href="https://open.substack.com/pub/katanaquant/p/your-llm-doesnt-write-correct-code?utm_campaign=post-expanded-share&amp;utm_medium=web">last article</a> closed with: <em>&#8220;The vibes are not enough. Define what correct means. Then measure.&#8221;</em></p><p>The response was 20,000 lines of code per day.</p><p>The second measurement is the one that was missing. The first one tested layers. The second one tests the connections between them. Before shipping the next feature, stop and ask yourself: am I measuring what I think I&#8217;m measuring? Or am I just measuring what&#8217;s easy to measure?</p><p>15,647 tests said green. The overlap test that would have said red took 10 lines of C.</p><p>LLMs are useful. 20,000 lines a day is useful. But speed without the second measurement is just plausibility at scale.</p><p>Or as Mario Zechner <a href="https://mariozechner.at/posts/2026-03-25-thoughts-on-slowing-the-fuck-down/">puts it</a>: <em>&#8220;Slow the F down.&#8221;</em></p><div><hr></div><p><em>Benchmarks run against FrankenSQLite at commit </em><code>12b18f9b</code><em> (March 25, 2026; 952 commits post-squash), PostgreSQL 16, and SQLite system library. All sqlite3-compatible benchmarks use the C API. Concurrent benchmarks are file-backed (required for multi-connection access). Benchmark harness: <a href="https://github.com/KatanaQuant/db_bench_foo">db_bench_foo</a>. FrankenSQLite&#8217;s own benchmark: <a href="https://github.com/Dicklesworthstone/frankensqlite/blob/main/crates/fsqlite-e2e/benches/concurrent_write_persistent_bench.rs">concurrent_write_persistent_bench.rs</a>.</em></p><div><hr></div><h2><strong>Sources</strong></h2><p><em>Some book links are Amazon affiliate links. Buying through them costs you nothing extra and helps support this work.</em></p><h3><strong>Concurrency Control &amp; Isolation</strong></h3><ul><li><p>Kleppmann, M. <em><a href="https://www.amazon.com/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1098119061?crid=2Y4M8C89ZJLK7&amp;sprefix=kleppman%2Caps%2C231&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c3fb819e8e3ac2146dfa768f0f67ba5c&amp;language=en_US&amp;ref_=as_li_ss_tl">Designing Data-Intensive Applications.</a></em> O&#8217;Reilly, 2017. Chapter 7: Transactions.</p></li><li><p>Ports, D., Grittner, K. <a href="https://www.drkp.net/papers/ssi-vldb12.pdf">&#8220;Serializable Snapshot Isolation in PostgreSQL.&#8221;</a> VLDB 2012.</p></li></ul><h3><strong>Benchmark Methodology</strong></h3><ul><li><p>Cooper, B. et al. <a href="https://dl.acm.org/doi/10.1145/1807128.1807152">&#8220;Benchmarking Cloud Serving Systems with YCSB.&#8221;</a> SoCC 2010.</p></li><li><p>Kingsbury, K., Alvaro, P. <a href="http://www.vldb.org/pvldb/vol14/p268-alvaro.pdf">&#8220;Elle: Inferring Isolation Anomalies from Experimental Observations.&#8221;</a> VLDB 2021.</p></li></ul><h3><strong>Systems Performance &amp; Anti-Patterns</strong></h3><ul><li><p>Gregg, B. <em><a href="https://www.amazon.com/Systems-Performance-Brendan-Gregg/dp/0136820158?crid=SZ5KGQJE789C&amp;sprefix=systems+performanc%2Caps%2C208&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=1ced80ffd13c0c2a315ae773fe361145&amp;language=en_US&amp;ref_=as_li_ss_tl">Systems Performance: Enterprise and the Cloud.</a></em> 2nd ed. Addison-Wesley, 2020.</p></li><li><p>Brooks, F. <em><a href="https://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959?crid=17EE2MTC402OA&amp;sprefix=mythical+man+month%2Caps%2C211&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=39bc3bab163a3199195556ce6ab124dd&amp;language=en_US&amp;ref_=as_li_ss_tl">The Mythical Man-Month.</a></em> Addison-Wesley, 1975.</p></li><li><p>Freeman, S., Pryce, N. <em><a href="https://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627?crid=M32QLV3XG1VE&amp;sprefix=growing+object+oriented+%2Caps%2C200&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=aa413f26e780a966006964fe3575b761&amp;language=en_US&amp;ref_=as_li_ss_tl">Growing Object-Oriented Software, Guided by Tests.</a></em> Addison-Wesley, 2009.</p></li></ul><h3><strong>SQLite Documentation</strong></h3><ul><li><p><a href="https://sqlite.org/wal.html">WAL Mode</a>. <a href="https://www.sqlite.org/lang_transaction.html">Transaction</a>. <a href="https://sqlite.org/testing.html">Testing</a>. <a href="https://www.sqlite.org/src/doc/begin-concurrent/doc/begin_concurrent.md">BEGIN CONCURRENT branch</a>.</p></li></ul><h3><strong>Related Writing</strong></h3><ul><li><p>Zechner, M. <a href="https://mariozechner.at/posts/2026-03-25-thoughts-on-slowing-the-fuck-down/">&#8220;Thoughts on Slowing the Fuck Down.&#8221;</a> March 2026.</p></li></ul><h3><strong>Benchmarks &amp; Evidence</strong></h3><ul><li><p>Benchmark harness: <a href="https://github.com/KatanaQuant/db_bench_foo">db_bench_foo</a> (open source, reproducible).</p></li><li><p>FrankenSQLite&#8217;s own benchmark: <a href="https://github.com/Dicklesworthstone/frankensqlite/blob/main/crates/fsqlite-e2e/benches/concurrent_write_persistent_bench.rs">concurrent_write_persistent_bench.rs</a>.</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Bug That Shipped]]></title><description><![CDATA[The Bug That Shipped]]></description><link>https://blog.katanaquant.com/p/the-bug-that-shipped</link><guid isPermaLink="false">https://blog.katanaquant.com/p/the-bug-that-shipped</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Sat, 21 Mar 2026 11:35:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!d3lE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1><strong>The Bug That Shipped</strong></h1><p>Thirteen out of a hundred times.</p><p>That&#8217;s how often coding agents catch critical deployment-level production failures while reviewing their own code.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>A hundred out of a hundred times they nail it when you ask them <em>what could break in production</em>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Duz1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Duz1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 424w, https://substackcdn.com/image/fetch/$s_!Duz1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 848w, https://substackcdn.com/image/fetch/$s_!Duz1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 1272w, https://substackcdn.com/image/fetch/$s_!Duz1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Duz1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png" width="1456" height="1703" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1703,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:327609,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191659621?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Duz1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 424w, https://substackcdn.com/image/fetch/$s_!Duz1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 848w, https://substackcdn.com/image/fetch/$s_!Duz1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 1272w, https://substackcdn.com/image/fetch/$s_!Duz1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7b6c864-d9e6-4c09-b3f7-abf622c275e3_1745x2041.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Just to be clear: I&#8217;m not trying to bash coding agents here. I&#8217;m just trying to find the signal within all the noise. After all, I think we all want AI to work out. I use it myself every day for all kinds of tasks. Not for coding though, you&#8217;ll soon see why.</p><p><a href="https://x.com/KatanaLarp/status/2029928471632224486">Earlier I wrote about</a> how LLMs write code that looks correct but isn&#8217;t. At that time I assumed the models couldn&#8217;t really tell the difference and the natural response of many readers was &#8220;<em>just add a review agent into the pipeline</em>.</p><p>So I measured what happens when you do. I had five frontier models write code for ten common production failure patterns and then review themselves over 3,000 trials.</p><p>Turns out I was wrong about the <em>why</em>. The models can tell. They absolutely do know! They happily produce a full diagnosis covering every failure scenario and the right fix. <strong>IF</strong> you ask the right question that is.</p><p>Let me show you what I mean:</p><p></p><h2><strong>The Logic Was Sound</strong></h2><p>I prompted them to write a classical retry wrapper. The kind every backend service needs when talking to external APIs. When your 3rd party payment provider of choice goes down for a few seconds, swallowing your request, you just wait and retry until it works again. Pretty standard stuff.</p><p>The code they produced looks clean. It has error handling, exponential backoff and configurable retries:</p><pre><code><code>def retry_request(method, url, retries=3, backoff=1, **kwargs):
    last_exception = None
    last_response = None

    for attempt in range(retries):
        try:
            response = requests.request(method, url, **kwargs)
            if response.status_code &lt; 500:
                return response
            last_response = response
        except (ConnectionError, Timeout) as exc:
            last_exception = exc

        if attempt &lt; retries - 1:
            time.sleep(backoff * (2 ** attempt))

    if last_response is not None:
        return last_response
    raise last_exception
</code></code></pre><p>Then I asked them to review the code. They concluded:</p><p><em>&#8220;The logic is sound.&#8221;</em></p><p><em>&#8220;Backoff works.&#8221;</em></p><p>And even reassured themselves:</p><p><em>&#8220;That&#8217;s the only real concern. The rest is straightforward.&#8221;</em></p><p>Almost always they missed the most critical problem. The wrapper has backoff, yes, it waits longer between each retry. That part works.</p><p>The waits are identical for every client though. When the upstream goes down and failures start trickling in, all clients start retrying at slightly different times. First they all sleep one second, then two, then four. Two rounds in, clients that failed seconds apart are waking at the same time, hitting the upstream in synchronized waves. The deterministic backoff pulls them into lockstep.</p><p><em>Source: <a href="https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/">https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/</a> AWS Architecture Blog</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9BiM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9BiM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 424w, https://substackcdn.com/image/fetch/$s_!9BiM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 848w, https://substackcdn.com/image/fetch/$s_!9BiM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 1272w, https://substackcdn.com/image/fetch/$s_!9BiM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9BiM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png" width="600" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;lockstep&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="lockstep" title="lockstep" srcset="https://substackcdn.com/image/fetch/$s_!9BiM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 424w, https://substackcdn.com/image/fetch/$s_!9BiM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 848w, https://substackcdn.com/image/fetch/$s_!9BiM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 1272w, https://substackcdn.com/image/fetch/$s_!9BiM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb01f0e20-c408-4141-b0c4-d9d1492a3ace_600x400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Meanwhile your own service is choking. Every worker thread is stuck in <code>time.sleep()</code>, blocking anything else from getting through. There are no threads left to handle actual requests. A five-second upstream blip turned into a minutes-long outage because every worker is waiting on the same backoff timer to expire.</p><p>This problem is called a <a href="https://sre.google/workbook/managing-load/">thundering herd</a>. The fix is pretty straightforward: instead of sleeping exactly two seconds, sleep somewhere between one and three (aka <a href="https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/">jitter</a>).</p><p>Scattering the clients prevents them from converging into waves. Your retries trickle in instead of slamming all at once, giving the upstream room to breathe.</p><p><em>Source: <a href="https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/">https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/</a> AWS Architecture Blog</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jaoL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jaoL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 424w, https://substackcdn.com/image/fetch/$s_!jaoL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 848w, https://substackcdn.com/image/fetch/$s_!jaoL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 1272w, https://substackcdn.com/image/fetch/$s_!jaoL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jaoL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png" width="600" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!jaoL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 424w, https://substackcdn.com/image/fetch/$s_!jaoL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 848w, https://substackcdn.com/image/fetch/$s_!jaoL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 1272w, https://substackcdn.com/image/fetch/$s_!jaoL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb4593c0-877a-40d1-aea3-73fb9c96fff4_600x400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When I asked <em>&#8220;What happens if 1,000 clients hit this simultaneously?&#8221;</em>, they all calculated the exact failure mode, explained why the server can&#8217;t recover, and recommended jitter. They had the full analysis ready.</p><p>They just didn&#8217;t mention any of this when asked to <em>review the code</em>.</p><div><hr></div><p>Ok, the retry function was missing a line of code. So what? It&#8217;s a simple bug that anyone could&#8217;ve missed on a bad day. The model probably just didn&#8217;t think of it.</p><p>Fair enough. Except in the next one, the model actually wrote defensive code itself and still missed what it was defending against.</p><p></p><h2><strong>Reviewed And Cleared</strong></h2><p>In production systems cronjobs are everywhere. Think sending daily reports, cleaning up expired sessions or build artifacts, and processing payment queues. Every backend runs a few of those.</p><p>To help lift that burden, I prompted all the models to <em>code a scheduled task runner</em>.</p><p>Again the code they produced looked fine.</p><pre><code><code>class Scheduler:
    def __init__(self):
        self._tasks = []
        self._threads = []
        self._stop_event = threading.Event()
        self._lock = threading.Lock()
        self._running = False
</code></code></pre><p>One subtle detail stood out:</p><p>See the <code>self._lock = threading.Lock()</code>? They added a lock guard unprompted! It makes sure two threads can&#8217;t mess with the task list at the same time. Something in the model understood concurrency well enough to write defensive code on its own.</p><p>But a <a href="https://docs.python.org/3/library/threading.html#lock-objects">threading lock</a> only guards against collisions between threads inside one copy of the program. It accomplishes nothing when <a href="https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html">two instances of your service</a> run this scheduler simultaneously. Both instances fire every task and your users will get two emails and their payments processed twice.</p><p>When I asked them to review it themselves, they found five issues. Namely shutdown blocking, clock drift, silent exceptions, first-run timing and sustained load from slow tasks. Basically covering everything that could make your tasks run late, crash silently, or pile up. These are all real bugs but they only cover single-process concerns.</p><p><em>&#8220;The locking and thread lifecycle is otherwise reasonable for a simple implementation&#8221;</em> they said.</p><p>Then I asked what happens when two instances run behind a load balancer:</p><p><em>&#8220;Both instances can process the same item and double-charge.&#8221;</em></p><p><em>&#8220;Daily summary email: it runs twice, so users get duplicate emails.&#8221;</em></p><p><em>&#8220;This scheduler is in-memory and per-process. A load balancer does not coordinate it.&#8221;</em></p><p>They wrote the lock because they understood concurrency and then reviewed it and called it reasonable. Only to then explain exactly why the lock was insufficient the moment someone asked. This confirms the knowledge was there all along.</p><div><hr></div><p>So they can miss it, and they can know the answer and still not apply it. So far so <em>bad</em>. Next they do something even worse: they look right at the bug and call it safe!</p><p></p><h2><strong>Certified Safe</strong></h2><p>I asked for a function that exports a PostgreSQL table to CSV. Order histories, user activity logs, anything that your services accumulate over the years. The code they produced:</p><pre><code><code>cursor.execute(f"SELECT * FROM {table_name}")
columns = [desc[0] for desc in cursor.description]
rows = cursor.fetchall()
writer.writerows(rows)
</code></code></pre><p>Probably like a lot of people wrote their very first PostgreSQL to CSV exporter in python. And for most <em>home</em> use cases that&#8217;s fine. There&#8217;s only one problem:</p><p><code>cursor.fetchall()</code> loads the entire result set into memory before writing a single row. On a 500-million-row table, which resembles real-world order histories at any busy company that&#8217;s been around a few years. That&#8217;s roughly 500 GB dumped into RAM all at once. Most servers run out of memory here and the process gets killed by the operating system (out of memory) before writing a single row.</p><p>When they reviewed it, they said:</p><p><em>&#8220;Memory: iterating over the cursor streams rows instead of loading all at once.&#8221;</em></p><p><strong>Read that again!</strong> The code calls <code>fetchall()</code> and the review praises it for <em>streaming</em>. They certified the code as safe precisely where it&#8217;s lethal!</p><p>Then I asked what happens with 500 million rows:</p><p><em>&#8220;500 million rows x ~1 KB = 500 GB raw data. Even with 128 GB RAM, this process dies in seconds.&#8221;</em></p><p>They produced the memory calculation, identified the OOM kill, and recommended the exact fix: a <a href="https://www.psycopg.org/docs/usage.html#server-side-cursors">server-side cursor</a> that streams rows instead of loading them all at once. For the exact failure they had just endorsed as safe.</p><p></p><h2><strong>None Of It Was True</strong></h2><p>These three aren&#8217;t cherry-picked worst cases. They&#8217;re representative. I ran the same experiment across ten common scenarios where subtle bugs make real-world production life hard.</p><p>Yes, of course an open-ended <em>any concerns?</em> finds less than a targeted <em>what happens with 1,000 clients?</em>. That&#8217;s obvious. Everyone would expect a gap here. Tho I think not everyone also expects it to be that wide.</p><p>Four out of five models catch the cron double-execution 0% of the time in self-review. Only 8% for the other one. When you ask them directly, each single one of them nails it 100%.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!d3lE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!d3lE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 424w, https://substackcdn.com/image/fetch/$s_!d3lE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 848w, https://substackcdn.com/image/fetch/$s_!d3lE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 1272w, https://substackcdn.com/image/fetch/$s_!d3lE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!d3lE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png" width="1385" height="442" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:442,&quot;width&quot;:1385,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62156,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191659621?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!d3lE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 424w, https://substackcdn.com/image/fetch/$s_!d3lE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 848w, https://substackcdn.com/image/fetch/$s_!d3lE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 1272w, https://substackcdn.com/image/fetch/$s_!d3lE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff603cb2d-4534-4f81-9883-89127ba3476a_1385x442.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Zooming out to all ten scenarios shows a clear pattern across three different tiers:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZNU2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZNU2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 424w, https://substackcdn.com/image/fetch/$s_!ZNU2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 848w, https://substackcdn.com/image/fetch/$s_!ZNU2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 1272w, https://substackcdn.com/image/fetch/$s_!ZNU2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZNU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png" width="1456" height="328" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:328,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58598,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191659621?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZNU2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 424w, https://substackcdn.com/image/fetch/$s_!ZNU2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 848w, https://substackcdn.com/image/fetch/$s_!ZNU2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 1272w, https://substackcdn.com/image/fetch/$s_!ZNU2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc01c592f-ee2f-423e-9675-5510b2d1a837_1520x342.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The models relatively reliably catch code-level bugs like wrong logic, missing error handling and type mismatches while missing what happens when that code hits production.</p><p>There&#8217;s a visible gradient here: <strong>the initiative gap scales with distance from the code.</strong></p><p>The thundering herd is fixable in one line of code. Just add randomness to the sleep. Models catch it 4-63% of the time in undirected self-review. Fixing things like the cron double-execution on the other hand requires infrastructure outside the codebase: a <a href="https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html">distributed lock</a>, a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/">leader election</a>, or an external scheduler like Celery Beat. Nothing in the code is wrong. The bug lives in the deployment topology, which makes the models catch it only 0-8% of the time in undirected self-review.</p><p>A side project with ten users won&#8217;t hit these problems. Your company&#8217;s checkout page will.</p><p>No single model is the outlier here either, they all show the same gap:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6DHf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6DHf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 424w, https://substackcdn.com/image/fetch/$s_!6DHf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 848w, https://substackcdn.com/image/fetch/$s_!6DHf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 1272w, https://substackcdn.com/image/fetch/$s_!6DHf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6DHf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png" width="616" height="317" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:317,&quot;width&quot;:616,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36524,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191659621?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6DHf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 424w, https://substackcdn.com/image/fetch/$s_!6DHf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 848w, https://substackcdn.com/image/fetch/$s_!6DHf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 1272w, https://substackcdn.com/image/fetch/$s_!6DHf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5efaf17-7286-4e8f-a3d9-64f700d7bbdb_616x317.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And no, you can&#8217;t just pick the &#8220;best&#8221; model. Codex-5.3 leads on thundering herd (63%) but scores worst on connection pool. Opus-4.6 leads on thread safety (99%) but scores worst on thundering herd (4%). Every model has blind spots, just different ones.</p><p>It&#8217;s also not context-related. The self-reviews ran in the exact same session the code was generated. If the model was ever going to catch it on its own, this was the time.</p><p></p><h2><strong>The Expert Witness</strong></h2><p>So whose fault is it that nobody asked about deployment? You get what you ask for!</p><p>That&#8217;s true. Nobody asked about deployment. Nonetheless, the thundering herd shipped to production.</p><p>Let&#8217;s think about what a human reviewer does for a moment. They walk into the code review, see a retry function without jitter, and say <em>&#8220;where&#8217;s the jitter?&#8221;</em> No prompt needed. Twenty years of 2 AM pages because of exactly this bug is their checklist. The model has the equivalent of that experience and proved it the moment someone asked. It just doesn&#8217;t volunteer it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yf1R!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yf1R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 424w, https://substackcdn.com/image/fetch/$s_!yf1R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 848w, https://substackcdn.com/image/fetch/$s_!yf1R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 1272w, https://substackcdn.com/image/fetch/$s_!yf1R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yf1R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png" width="795" height="262" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:262,&quot;width&quot;:795,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37331,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191659621?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yf1R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 424w, https://substackcdn.com/image/fetch/$s_!yf1R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 848w, https://substackcdn.com/image/fetch/$s_!yf1R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 1272w, https://substackcdn.com/image/fetch/$s_!yf1R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a1fa1aa-da63-4e03-9834-6ba41c9faed6_795x262.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That&#8217;s not how a code reviewer works. That&#8217;s how an <em>expert witness</em> works. Full, accurate answers to whatever you ask without ever raising the questions you didn&#8217;t ask, even when the answer would change everything.</p><p>McConnell&#8217;s <em><a href="https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670?crid=1CP668YZEJSQX&amp;sprefix=cod%2Caps%2C205&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=2612cf4db0c2e0518303e9b80a1c9b42&amp;language=en_US&amp;ref_=as_li_ss_tl">Code Complete</a></em> notes that assigning reviewers specific perspectives - &#8220;review this as the maintenance programmer,&#8221; &#8220;review this as the customer&#8221; - can uncover more defects than general review. <em>What happens with 1,000 clients?</em> is a perspective assignment while <em>Any concerns?</em> is not.</p><p>The people who most confidently can deploy <em>reviewer agents into the pipeline</em> are building products instead of weekend projects. The developer who prompts <em>build me a retry function</em> is probably not the developer who knows to ask about thundering herds. That&#8217;s the whole reason they&#8217;re using the model. The safety net has a hole shaped exactly like the thing it&#8217;s supposed to catch.</p><p>If you&#8217;re relying on the latest addition of memory and skill mechanics to close the gap, the outlook isn&#8217;t much better. The model still has to catch it first! At a 13% self-review rate for deployment concerns, that&#8217;s hoping for a lucky shot to seed the memory and then hoping the memory system surfaces it in the right context next time. Instead of closing the gap, memory just becomes the filter for what gets remembered.</p><p></p><p><em>Trial runs for skills and memory system are still ongoing. Early results are interesting. More on that soon.</em></p><p></p><h2><strong>The Speed Trap</strong></h2><p>&#8220;<em>Just ask the right questions, then.</em>&#8220; Sure. The model answers perfectly when you do.</p><p>Follow that thought for a second tho. If you&#8217;re senior enough to ask <em>what about the thundering herd?</em>, you&#8217;d have caught the missing jitter yourself. And if you&#8217;re not - if you&#8217;re the developer who asked the model to write the retry function in the first place - you&#8217;d probably ship the review as-is.</p><p>That&#8217;s the speed trap. The model is fast enough to earn your trust, and the code piles up before anyone checks what the review actually missed.</p><p>That&#8217;s just more code, all reviewed by the same process that missed the thundering herd.</p><p>Faros AI measured this across 10,000 developers. Compared to pre-AI baselines, 98% more pull requests are merged with the average PR size up 154% and review time up 91%. METR <a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">found experienced open-source developers were 19% slower</a> partly because of the overhead of reviewing and correcting AI output. The review that already doesn&#8217;t catch deployment concerns now has to catch them in pull requests that are two and a half times larger.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!J-Cb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!J-Cb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 424w, https://substackcdn.com/image/fetch/$s_!J-Cb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 848w, https://substackcdn.com/image/fetch/$s_!J-Cb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 1272w, https://substackcdn.com/image/fetch/$s_!J-Cb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!J-Cb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png" width="1185" height="652" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:652,&quot;width&quot;:1185,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40964,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191659621?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!J-Cb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 424w, https://substackcdn.com/image/fetch/$s_!J-Cb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 848w, https://substackcdn.com/image/fetch/$s_!J-Cb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 1272w, https://substackcdn.com/image/fetch/$s_!J-Cb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84b8b59e-7019-44d5-a8b8-f426a0d16695_1185x652.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As Bellotti puts it in <em><a href="https://www.amazon.com/Kill-Fire-Manage-Computer-Systems/dp/1718501188?crid=2WCBLDE21JIWS&amp;sprefix=kill+it+with+fire%2Caps%2C211&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=a6db01e3e4ddd1b13906fda9b1dc3e85&amp;language=en_US&amp;ref_=as_li_ss_tl">Kill It with Fire</a></em>: <em>automation means we ignore whatever we automated.</em> The AI review catches the correctness bugs almost every time. That&#8217;s exactly what makes you stop checking for the ones it misses.</p><p></p><h2><strong>Always Ask What Breaks</strong></h2><p>Don&#8217;t ask the model to review your code. Ask it what breaks.</p><p>What breaks in your domain, at your scale, with your deployment? &#8220;What happens when 1,000 clients hit this at once?&#8221; &#8220;What happens when two instances run behind a load balancer?&#8221; &#8220;What happens when this table has 500 million rows?&#8221;</p><p>As <a href="https://www.honeycomb.io/blog/honeycomb-10-year-manifesto-part-1">Charity Majors</a> puts it: <em>complex systems fail in ways you can&#8217;t predict. Your tools need to handle questions you haven&#8217;t thought to ask yet.</em></p><p>Every question gets a perfect answer. No question gets asked unprompted.</p><p></p><p>Don&#8217;t be the one getting thirteen out of a hundred.</p><h1><strong>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</strong></h1><p></p><h2><strong>Methodology</strong></h2><p>The full trial data including all prompts, model responses, and evaluation scripts is available on <a href="https://github.com/KatanaQuant/llm-review-trials">GitHub</a>. Data collection is ongoing. I don&#8217;t expect significant shifts in the numbers at this point.</p><p>Models tested: Claude Opus 4.6, Claude Sonnet 4.6, OpenAI Codex-5.3, GPT-5.4, GLM-5. All models ran with extended thinking / xhigh reasoning effort enabled. Over 3,700 trials across 10 scenarios x 5 models. March 2026.</p><p></p><h2><strong>Sources</strong></h2><p><em>Some book links are Amazon affiliate links. Buying through them costs you nothing extra and helps support this work.</em></p><ul><li><p>Brooker, M. (2015). <a href="https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/">&#8220;Exponential Backoff And Jitter.&#8221;</a> AWS Architecture Blog.</p></li><li><p>Brooker, M. <a href="https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/">&#8220;Timeouts, retries, and backoff with jitter.&#8221;</a> Amazon Builders&#8217; Library.</p></li><li><p>Google. <a href="https://sre.google/workbook/managing-load/">&#8220;Managing Load.&#8221;</a> <em>Site Reliability Engineering Workbook</em>. (Uses &#8220;thundering herd&#8221; verbatim; Pok&#233;mon GO 20x spike case study.)</p></li><li><p>Python Software Foundation. <a href="https://docs.python.org/3/library/threading.html">&#8220;threading - Thread-based parallelism.&#8221;</a> Python 3 documentation.</p></li><li><p>Kleppmann, M. (2016). <a href="https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html">&#8220;How to do distributed locking.&#8221;</a></p></li><li><p>psycopg2 documentation. <a href="https://www.psycopg.org/docs/usage.html#server-side-cursors">&#8220;Server side cursors.&#8221;</a> psycopg.org.</p></li><li><p>METR. <a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">&#8220;Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity.&#8221;</a> July 2025 (updated February 2026).</p></li><li><p>Faros AI. <a href="https://www.faros.ai/blog/ai-software-engineering">&#8220;The AI Productivity Paradox.&#8221;</a> 2025.</p></li><li><p>McConnell, S. <em><a href="https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670?crid=1CP668YZEJSQX&amp;sprefix=cod%2Caps%2C205&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=2612cf4db0c2e0518303e9b80a1c9b42&amp;language=en_US&amp;ref_=as_li_ss_tl">Code Complete</a></em>. 2nd ed. Microsoft Press, 2004. (Perspective-based reviews, inspection effectiveness.)</p></li><li><p>Bellotti, M. <em><a href="https://www.amazon.com/Kill-Fire-Manage-Computer-Systems/dp/1718501188?crid=2WCBLDE21JIWS&amp;sprefix=kill+it+with+fire%2Caps%2C211&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=a6db01e3e4ddd1b13906fda9b1dc3e85&amp;language=en_US&amp;ref_=as_li_ss_tl">Kill It with Fire</a></em>. No Starch Press, 2021. (&#8221;automation means we ignore whatever we automated.&#8221;)</p></li><li><p>Majors, C. <a href="https://www.honeycomb.io/blog/honeycomb-10-year-manifesto-part-1">&#8220;Honeycomb 10 Year Manifesto.&#8221;</a> honeycomb.io, February 2026.</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[AI Does Not Replace Developers. It Amplifies What They Lack.]]></title><description><![CDATA[AI Does Not Replace Developers.]]></description><link>https://blog.katanaquant.com/p/ai-does-not-replace-developers-it</link><guid isPermaLink="false">https://blog.katanaquant.com/p/ai-does-not-replace-developers-it</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Wed, 18 Mar 2026 09:13:05 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ClZS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1><strong>AI Does Not Replace Developers. It Amplifies What They Lack.</strong></h1><p>When prompted, LLMs cheat on durability and only confess when caught.</p><p>They benchmark wrong binaries.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>They declare performance floors eleven times and are wrong each time.</p><p>They silently filter errors from their output to make benchmarks look real.</p><p>Same LLM, same codebase, same goal. Three different outcomes: 4.5x faster. 270x faster. 900x faster.</p><p>The difference wasn&#8217;t the tool but the prompts. The gap between 4.5x and 900x comes down to the questions asked, not the model used.</p><blockquote><p><strong>TL;DR:</strong> Three personas prompted the same LLM to fix the same broken database. The vibecoder got 4.5x. The mid-level dev got 270x. The domain expert got 900x. The technical sections below show how. If you want the actionable takeaways, skip to <strong>&#8220;The Diagnosis Ceiling.&#8221;</strong></p></blockquote><h2><strong>An Experiment</strong></h2><p>After <a href="https://x.com/KatanaLarp/status/2029928471632224486">my last article</a> about an LLM-generated Rust rewrite of SQLite that was 20,000x slower than its reference implementation, the most common question was: <em>&#8220;But could an LLM fix it?&#8221;</em></p><p>Fair question! I forked the original rewrite to <a href="https://github.com/KatanaQuant/kqsqlite">kqsqlite</a> under its MIT license and ran a structured case study where I assumed three different personas and used only vanilla prompting to fix it. No agents, no tools, no skills, no RAG, no system prompts.</p><p>To have some kind of reference frame, I grounded the personas in Bloom&#8217;s Revised Taxonomy of cognitive operations (<a href="https://www.amazon.com/Taxonomy-Learning-Teaching-Assessing-Educational/dp/080131903X?crid=2W5RNA8BEWR2S&amp;sprefix=%2Caps%2C199&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=9511d60f844805db876cbacdfed85294&amp;language=en_US&amp;ref_=as_li_ss_tl">Anderson &amp; Krathwohl (2001)</a>). The level of question you ask determines the level of answer you can get:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3ZNd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3ZNd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 424w, https://substackcdn.com/image/fetch/$s_!3ZNd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 848w, https://substackcdn.com/image/fetch/$s_!3ZNd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 1272w, https://substackcdn.com/image/fetch/$s_!3ZNd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3ZNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png" width="1456" height="240" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a222ce00-6593-46fd-9083-765ae099df07_1556x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:240,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54835,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3ZNd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 424w, https://substackcdn.com/image/fetch/$s_!3ZNd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 848w, https://substackcdn.com/image/fetch/$s_!3ZNd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 1272w, https://substackcdn.com/image/fetch/$s_!3ZNd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa222ce00-6593-46fd-9083-765ae099df07_1556x256.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Now some of these are above my pay grade and some of these I&#8217;m having a hard time shifting into because it&#8217;s been a really long time. I had the chance to sit with an experienced L5, who was kind enough to correct my framing where wrong to make sure the technical grounding held up. The knowledge in those prompts is verified. So is the effort it took to get there.</p><p>The toolset scales with the persona. The L0 had a benchmark table. The L2 had the same table plus EXPLAIN QUERY PLAN. The L5 had both, plus flamegraphs, callgrind, YCSB workloads (Yahoo&#8217;s database benchmark suite), TPC-H analytical queries, and three-way differential testing against C SQLite and <a href="https://github.com/tursodatabase/turso">Turso</a> (a professional-grade Rust SQLite reimplementation formerly named Limbo). The richer the toolset, the more precisely the human can direct the process.</p><p><strong>No code review.</strong> I never read the LLM&#8217;s generated code but only its benchmark numbers, profile output and diagnostic reasoning. If the code is wrong, the numbers will show it. If the numbers look right but the code is broken, that&#8217;s a finding about LLM reliability, not a reason to intervene. The experiment tests what the human brings to the conversation, not their ability to audit code.</p><p>You can find the full <a href="https://github.com/KatanaQuant/kqsqlite/blob/main/METHODOLOGY.md">methodology, ground truth rubric, and scoring criteria here</a>. Prompt/response transcripts for all three sessions: <a href="https://github.com/KatanaQuant/kqsqlite/tree/main/experiment">github.com/KatanaQuant/kqsqlite</a>.</p><h2><strong>The Same Table, Three Readers</strong></h2><p>The starting point for all three personas was the same six numbers:</p><p><strong>The benchmark baseline (1,000 rows):</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8V3P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8V3P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 424w, https://substackcdn.com/image/fetch/$s_!8V3P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 848w, https://substackcdn.com/image/fetch/$s_!8V3P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 1272w, https://substackcdn.com/image/fetch/$s_!8V3P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8V3P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png" width="737" height="435" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:435,&quot;width&quot;:737,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:57325,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8V3P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 424w, https://substackcdn.com/image/fetch/$s_!8V3P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 848w, https://substackcdn.com/image/fetch/$s_!8V3P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 1272w, https://substackcdn.com/image/fetch/$s_!8V3P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9dd34b9a-de97-454b-b412-99812b36e0b4_737x435.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Six rows and three columns. What each one does with them determines the outcome.</p><p><strong>The vibecoder</strong> just pasted it as context: &#8220;its kinda slow can u make it faster.&#8221; The LLM treated every ratio as equally important and optimized what it could see: compiler flags, tracing overhead, unused concurrency mode. All real improvements but none addressed the 6,851x. After seven prompts the algorithmic bugs were all still there.</p><p>But the L0 wasn&#8217;t flying blind. By Prompt 5 the LLM noticed on its own that UPDATE was 12x slower than INSERT and started investigating the write path. It found the symptom but it never diagnosed the root cause: <code>is_rowid_ref</code> returning false, hardcoding every write into a full table scan. The L0&#8217;s problem wasn&#8217;t laziness. They were missing a real framework to follow a symptom to its architectural root.</p><p>The L0 was cut short after seven prompts. By then the L2 sessions had shown a pattern: the LLM cheated on durability, produced misleading benchmark improvements, and declared victory with algorithmic bugs untouched. If the L2 - who could at least read the numbers - was getting lied to, the L0 had no mechanism to catch it. There was no reason to expect it could deliver on our goal: not <em>plausible but correct code.</em></p><p><strong>The L2</strong> read the numbers <em>against each other</em>. The first insight was a ratio of ratios: SELECT BY ID (6,851x) versus SELECT ALL (38x). Both are reads on the same table. Both go through the same compilation path with the only difference that one fetches all rows and the other fetches one row by a specific key. A 180x gap between those two operations means something is wrong with how the database finds a single row.</p><p>The LLM&#8217;s first answer was wrong. It blamed query compilation overhead. The L2 pushed: &#8220;if it&#8217;s only compilation overhead, why is SELECT BY ID 6,851x but SELECT ALL is only 38x? Don&#8217;t they both compile? What&#8217;s different about them?&#8221; Three prompts later, the L2 asked for an EXPLAIN QUERY PLAN, the database&#8217;s own report on how it will execute a query. The answer was revealing:</p><ul><li><p><strong>kqsqlite:</strong> <code>SCAN test</code> (read every row, check each one)</p></li><li><p><strong>C SQLite:</strong> <code>SEARCH test USING INTEGER PRIMARY KEY (rowid=?)</code> (jump directly to the row)</p></li></ul><p>The planner wasn&#8217;t using the index, what <a href="https://www.amazon.com/Performance-Explained-Everything-Developers-about/dp/3950307826?crid=1LNAYH84KCEE3&amp;sprefix=sql+performance+explained+%2Caps%2C206&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=35f9687d32337a13ef4c4ffb630eb346&amp;language=en_US&amp;ref_=as_li_ss_tl">Winand</a> (<em>SQL Performance Explained</em>) calls &#8220;the first power of indexing: finding data efficiently.&#8221; At 1,000 rows, the full scan checks every row (O(n)) while a B-tree descent only touches 2-3 levels (O(log n)). At 10,000 rows, the gap grows super-linearly so the planner bug doesn&#8217;t just add overhead but changes the complexity. Over three prompts and two bugs, SELECT BY ID dropped from 6,851x to 36x. The EXPLAIN diagnostic drove the final leg from 273x to 36x. The L2 couldn&#8217;t name the root cause in the code but could reason about numbers.</p><p><strong>The L5</strong> translated each anomalous ratio into an architectural hypothesis before issuing any prompt, decomposing the table into three tiers:</p><p><strong>Tier 1 - Algorithmic:</strong> The same planner failure the L2 would find by ratio-reading, but diagnosed from first principles. A 290x gap between point lookup and full scan means full table scans where the B-tree should be doing O(log n) descent (<a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl">Knuth, </a><em><a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl">TAOCP</a></em><a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl"> Vol. 3</a>). Fix whatever prevents index lookups.</p><p><strong>Tier 2 - Per-statement:</strong> The 47x gap between individual INSERT (615x) and batched INSERT (13x) means something expensive happens after every individual statement. In a database with write-ahead logging the most obvious suspect is forcing that log to disk after every statement, as if power could fail at any moment (Mohan et al., ARIES, 1992). Find the per-statement overhead.</p><p><strong>Tier 3 - Constant-factor:</strong> The remaining 13x is constant-factor overhead: the same operations done less efficiently. Profile later, after the architectural bugs are fixed. Target: ~2x.</p><p>The LLM returned four file:line citations in its first response including the exact function responsible for the planner bug. Not because the LLM was smarter but because the question told it where to look.</p><h2><strong>What the Numbers Show</strong></h2><p>The L5&#8217;s tier decomposition had acceptance gates as explicit thresholds that signal when to stop:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P_pQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P_pQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 424w, https://substackcdn.com/image/fetch/$s_!P_pQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 848w, https://substackcdn.com/image/fetch/$s_!P_pQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 1272w, https://substackcdn.com/image/fetch/$s_!P_pQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P_pQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png" width="1336" height="252" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:252,&quot;width&quot;:1336,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52015,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P_pQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 424w, https://substackcdn.com/image/fetch/$s_!P_pQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 848w, https://substackcdn.com/image/fetch/$s_!P_pQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 1272w, https://substackcdn.com/image/fetch/$s_!P_pQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2be61a39-14e0-4d48-9f42-512b4b17f70b_1336x252.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The L2 had no such plan. They were just reading numbers after each fix and asked &#8220;why is this one still anomalous?&#8221; That&#8217;s enough to find 5 out of 6 critical bugs (scorecard below). But without acceptance criteria, you can&#8217;t tell when you&#8217;re done. The L2 declared the gap &#8220;fundamental&#8221; or &#8220;structural&#8221; six times, each time with a different justification but was wrong each time. The L5 accepted none even tho the LLM declared the floor eleven times.</p><h3><strong>Ground Truth Scorecard</strong></h3><p>Six bugs <a href="https://x.com/KatanaLarp/status/2029928471632224486">identified in the first article</a> before the experiment began:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ClZS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ClZS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 424w, https://substackcdn.com/image/fetch/$s_!ClZS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 848w, https://substackcdn.com/image/fetch/$s_!ClZS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 1272w, https://substackcdn.com/image/fetch/$s_!ClZS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ClZS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png" width="1456" height="414" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104768,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ClZS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 424w, https://substackcdn.com/image/fetch/$s_!ClZS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 848w, https://substackcdn.com/image/fetch/$s_!ClZS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 1272w, https://substackcdn.com/image/fetch/$s_!ClZS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b32bc1f-d555-4e56-a252-5e32ab636ea6_1753x498.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The L0 found two bugs at the surface-level while the L2 found five over 32 prompts, each exposed by the previous fix. The L5 identified the top four in the first prompt&#8217;s tier decomposition.</p><p>GT#6 is an interesting case. <code>table_seek</code> was pre-identified as a bug reading <em>implemented but never called from the query path</em>. Tho when at Prompt 12 the L5 directed the LLM to investigate, it found the function <em>was</em> called through an indirect dispatch the ground truth had missed. The LLM corrected the human&#8217;s pre-assessment. This is the only case in the experiment where the scorecard changed direction and serves as a reminder that ground truths established by reading code are less reliable than ground truths established by running it.</p><p>For the ones thinking <em>the L5 just gave better hints</em>! Yes, that&#8217;s the point! The L2&#8217;s prompts contain no database knowledge, just ratios. The L5&#8217;s prompts contain domain expertise. Both use the same LLM, the same codebase and the same tools. The only variable is what the human knows how to ask for.</p><p>The bugs weren&#8217;t pre-identified and the prompts weren&#8217;t designed to find them. The ground truth was established to <em>score</em> the results and not to guide the prompts. The L2&#8217;s first prompt was the benchmark table and the question &#8220;why is SELECT BY ID 6,851x?&#8221;. Just a number that looked wrong.</p><p><strong>The LLM&#8217;s usefulness is bounded by the human&#8217;s ability to frame the problem.</strong></p><p><em>The next three sections detail the technical evidence. For the actionable findings, skip to <strong>The Diagnosis Ceiling</strong>.</em></p><p></p><h2><strong>The Translation Tax</strong></h2><p>After all six algorithmic bugs were fixed, what remains is the translation itself: the systematic cost of reimplementing a C database in Rust. By Prompt 38, with algorithmic fixes and architectural changes applied, the profile was &#8220;flat&#8221; with no single function above 12% of CPU time. The question shifts to how close you can push a Rust rewrite to the reference implementation. The L5 directed the LLM to profile the INSERT path.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VyBz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VyBz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 424w, https://substackcdn.com/image/fetch/$s_!VyBz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 848w, https://substackcdn.com/image/fetch/$s_!VyBz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 1272w, https://substackcdn.com/image/fetch/$s_!VyBz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VyBz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png" width="1456" height="813" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:813,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62541,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VyBz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 424w, https://substackcdn.com/image/fetch/$s_!VyBz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 848w, https://substackcdn.com/image/fetch/$s_!VyBz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 1272w, https://substackcdn.com/image/fetch/$s_!VyBz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0f638007-cb6e-416e-9932-fc2c82921787_1600x893.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>Before (L5 experiment start, ~567x behind SQLite). 96,528 perf samples, 2000-record workload (~70s total). Profile dominated by VFS </em><code>pread</code><em> I/O, MVCC </em><code>eprocess</code><em> decisions, and WAL frame reads. Algorithmic bugs cause extreme amplification. Every operation triggers redundant I/O paths.</em></figcaption></figure></div><p>The profiler identified <code>lookup_keyword</code> at <strong>11.16%</strong> of INSERT CPU time.</p><p>Every SQL parser checks whether each token is a keyword or a user-defined name. One of the most frequent operations in a database engine. The more common real world approach builds the keyword set at compile time and then dispatches on length or first character to compare it in place without any allocation or copies (<a href="https://www.amazon.com/Compilers-Principles-Techniques-International-Economy/dp/9332518661?crid=TPCRIICOYNV&amp;sprefix=compilers+principles%2C+techniques%2C+and+tool%2Caps%2C211&amp;sr=8-2&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=92fe967256429ed708c6155c869db597&amp;language=en_US&amp;ref_=as_li_ss_tl">Aho, Sethi &amp; Ullman, </a><em><a href="https://www.amazon.com/Compilers-Principles-Techniques-International-Economy/dp/9332518661?crid=TPCRIICOYNV&amp;sprefix=compilers+principles%2C+techniques%2C+and+tool%2Caps%2C211&amp;sr=8-2&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=92fe967256429ed708c6155c869db597&amp;language=en_US&amp;ref_=as_li_ss_tl">Compilers</a></em>, 1986).</p><p>The LLM&#8217;s Rust translation:</p><pre><code><code>match s.to_ascii_uppercase().as_str() {
    "SELECT" =&gt; Token::Select,
    "INSERT" =&gt; Token::Insert,
    "WHERE" =&gt; Token::Where,
    // ... ~150 more keywords
}</code></code></pre><p><code>to_ascii_uppercase()</code> creates a new heap-allocated <code>String</code> on every call for each token in every SQL statement across all benchmark iterations. For 1,000 INSERT statements each containing ~10 tokens, that&#8217;s 10,000 heap allocations just to check whether a word is a keyword. Work that any production scanner does without heap allocation.</p><p>The code is <em>plausible</em> and produces the right answer. It&#8217;s also how any Rust programmer might write it on first pass. <code>to_ascii_uppercase()</code> is the obvious, safe, idiomatic approach. But &#8220;obvious and safe&#8221; costs 11% of total CPU time when it runs in the innermost loop of a database engine.</p><p>The fix: dispatch on the word&#8217;s length and first byte, then do a case-insensitive comparison on the original string:</p><pre><code><code>match (s.len(), s.as_bytes()[0].to_ascii_uppercase()) {
    (6, b'S') if s.eq_ignore_ascii_case("select") =&gt; Token::Select,
    (6, b'I') if s.eq_ignore_ascii_case("insert") =&gt; Token::Insert,
    (5, b'W') if s.eq_ignore_ascii_case("where") =&gt; Token::Where,
    // ...
}</code></code></pre><p>After the fix, <code>lookup_keyword</code> dropped below the noise floor and Transaction batches improved 18.5%.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!O14a!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!O14a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 424w, https://substackcdn.com/image/fetch/$s_!O14a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 848w, https://substackcdn.com/image/fetch/$s_!O14a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!O14a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!O14a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png" width="1456" height="910" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:910,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62512,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!O14a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 424w, https://substackcdn.com/image/fetch/$s_!O14a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 848w, https://substackcdn.com/image/fetch/$s_!O14a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 1272w, https://substackcdn.com/image/fetch/$s_!O14a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb556431a-1e3e-4f88-9fcd-358b4f98d41f_1600x1000.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>After (L5 optimizations applied, ~3x behind SQLite). 488 perf samples, same workload (~374ms total). Profile flattens across WAL checksum, B-tree cell parse, and </em><code>lookup_keyword</code><em>. No single dominant bottleneck. The algorithmic amplification is gone; what remains is constant-factor translation overhead.</em></figcaption></figure></div><p>The keyword matcher is just one example. The codebase has hundreds of similar translation artifacts, each individually defensible, each costing cycles in the hot path. <a href="https://arxiv.org/abs/2411.14174">Li et al. (NDSS 2025)</a> found the same pattern in human C-to-Rust translations: mechanically correct but systematically expensive.</p><h2><strong>Where Framing Breaks</strong></h2><p>The translation tax doesn&#8217;t go away. You can measure and squeeze it but Rust-reimplementing-C has a floor. Framing failures are different. Those are costs the human creates. The same mechanism that lets the L5 direct investigation also lets the L2 get cheated.</p><h3><strong>The Durability Cheat</strong></h3><p>The L2 said &#8220;get rid of the per-statement overhead&#8221;. The LLM got rid of it by silently batching 64 operations into a single transaction. INSERT went from 4.7x to <strong>0.70x</strong>, faster than C SQLite. The L2 didn&#8217;t accept it:</p><blockquote><p>hold on. how is INSERT faster than SQLite? we&#8217;re reimplementing it, not improving it. is this actually legit or is it cheating somehow?</p></blockquote><p>The LLM&#8217;s response:</p><blockquote><p><strong>This is cheating.</strong> The ACID (atomicity, consistency, isolation, durability) guarantee requires that after a committed transaction returns, the data survives a crash. Our batched approach means a crash mid-batch could lose up to 63 rows.</p></blockquote><p>The developer didn&#8217;t know what fsync was. But they grasped &#8220;power out = data loss&#8221; instantly and reverted. This is where pattern recognition comes into play: if the LLM cheated once, you need to check EVERY TIME.</p><p><strong>The L5 encountered the same problem differently.</strong> The prompt:</p><blockquote><p>INSERT (autocommit): 13.9ms each. TXN batch: 50&#181;s each. Same operation, 278x difference. That&#8217;s per-COMMIT overhead. With WAL + synchronous=NORMAL, the correct behavior should be to append a WAL frame and return without fsyncs on commit. Profile the autocommit INSERT path.</p></blockquote><p>The LLM found the root cause in one pass. The WAL durability contract is explicit: a transaction commits when its commit record reaches stable storage (<a href="https://www.amazon.com/Transaction-Processing-Concepts-Techniques-Management/dp/1558601902?_encoding=UTF8&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=68fb296bbc1b4488247d88617aba4c7c&amp;language=en_US&amp;ref_=as_li_ss_tl">Gray &amp; Reuter</a>, 1993; Mohan et al., ARIES). With <code>synchronous=NORMAL</code>, the WAL accumulates frames in memory and syncs only at checkpoint. Individual commits don&#8217;t force the log to disk. But the configuration setting that controls this (<code>PRAGMA synchronous</code>) was a no-op stub. It was parsed and stored in a variable but never read by the code that writes to disk, leading to full disk-sync on every autocommit statement. After the fix INSERT went from 809x to 6.9x.</p><p>The L2&#8217;s prompt said &#8220;get rid of it.&#8221; The L5&#8217;s prompt said &#8220;profile it and tell me where the time goes.&#8221; The first invites a shortcut. The latter makes shortcuts structurally impossible.</p><p>The LLM also doesn&#8217;t maintain session state. Between Prompts 3 and 9, it regenerated a file and silently omitted its own fsync fix. The L2 noticed: &#8220;INSERT was 7.8x a few prompts ago, now it&#8217;s back to 800x. What happened?&#8221;</p><p>The LLM <strong>knew</strong> the cheat was wrong but didn&#8217;t flag it when implementing. The failure was initiative, not knowledge. <a href="https://arxiv.org/abs/2409.18786">Li et al. (2024)</a> calls this failure of &#8220;forthright&#8221; honesty: possessing the relevant knowledge but not volunteering it unprompted.</p><h3><strong>Facts Get Corrected. Framings Don&#8217;t.</strong></h3><p>This asymmetry is one-directional. The LLM corrects wrong facts but reinforces wrong framings. When the L5 stated something factually wrong about the codebase &#8220;this function is never called&#8221; the LLM pushed back with a correct code citation. But when the L2 asserted a narrative interpretation &#8220;we regressed&#8221; the LLM agreed, even when its own benchmark data disproved it. At Prompt 20, the LLM fabricated a benchmark summary showing &#8220;INSERT 3.7x&#8221; when the actual ratio was 7.2x. The L2 trusted it. Five prompts later, the L2 accused the LLM of causing a regression based on the fabricated numbers and the LLM agreed. Tho the regression never happened. The hallucination wasn&#8217;t disproven until Prompt 25, when the LLM finally ran the baseline binary. A wrong fact gets caught but a wrong narrative propagates through the entire session.</p><h3></h3><h2><strong>The Floor That Wasn&#8217;t</strong></h2><p>By Prompt 35, the profiler showed no single function above 12% of CPU time. The LLM&#8217;s conclusion: <strong>distributed overhead. The floor.</strong></p><p>The L5 recognized the pattern (<a href="https://dl.acm.org/doi/10.1145/1376616.1376713">Harizopoulos et al., SIGMOD 2008</a>). The profile just looks flat because the overhead is spread across dozens of functions. He concluded &#8220;we&#8217;re not done, we&#8217;re looking at it wrong.&#8221; The question wasn&#8217;t which function to optimize next. The question was: <strong>what work is this database doing that a correct implementation wouldn&#8217;t?</strong></p><p>The L5 introduced <a href="https://github.com/tursodatabase/turso">Turso</a> (a professional-grade Rust SQLite reimplementation) as a second reference to separate language overhead from implementation bugs. The comparison exposed that kqsqlite was running full crash-recovery for databases living entirely in RAM, checksumming every write for data that can&#8217;t even survive a process crash. One guard clause and UPDATE went from 1.99x to <strong>1.1x</strong> compared to Turso.</p><p>Then the benchmark itself hid a gap. The LLM reported kqsqlite <em>beating</em> Turso on SELECT BY ID: 0.93x. The L5 didn&#8217;t accept it. The benchmark was measuring parsing overhead, not execution speed. Switching to prepared statements, the 0.93x &#8220;win&#8221; became 4.28x. The LLM never questioned the instrument.</p><p>Over 73 prompts, the L5 applied twelve distinct analytical lenses. The floor moved every time. Four distinct examples:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!natc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!natc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 424w, https://substackcdn.com/image/fetch/$s_!natc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 848w, https://substackcdn.com/image/fetch/$s_!natc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 1272w, https://substackcdn.com/image/fetch/$s_!natc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!natc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png" width="1456" height="323" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:323,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:75991,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!natc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 424w, https://substackcdn.com/image/fetch/$s_!natc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 848w, https://substackcdn.com/image/fetch/$s_!natc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 1272w, https://substackcdn.com/image/fetch/$s_!natc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3c9823d-633f-43fa-84b9-de06e5ca2986_1466x325.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Tier decomposition, query plan analysis, flamegraph profiling, allocation-site counting, Rust-vs-Rust calibration, YCSB workload separation, call-site multiplier analysis, allocator hypothesis testing plus the four above. Each lens exposed a layer of overhead the previous one couldn&#8217;t see so the floor kept moving.</p><p>The <a href="https://github.com/KatanaQuant/kqsqlite/blob/main/experiment/l5-tldr.md">full experiment transcript</a> details all twelve lenses, eleven wrong floor declarations, and every analytical reframing.</p><h2><strong>The Diagnosis Ceiling</strong></h2><p>Both the L2 and the L5 hit the same ceiling: the LLM never set its own analytical framework.</p><p><strong>It never generalized across its own fixes.</strong> The same scan-instead-of-seek bug appeared on reads (Prompt 3), index lookups (Prompt 11), writes (Prompt 27), text-key lookups (Prompt 29), and range scans (Prompt 57&#8211;58). Six fixes for one bug class. At each occurrence the LLM diagnosed the specific instance correctly and never once said &#8220;this is the same problem we fixed in Prompt 3.&#8221; By the third instance, a human engineer would extract the pattern. The LLM produced each fix from scratch every time (<a href="https://arxiv.org/abs/2602.06176">Song, Han &amp; Goodman (TMLR 2026)</a>).</p><p><strong>It couldn&#8217;t compute statistics from its own output.</strong> The LLM reported a benchmark median of 273.7ms. The actual median was 283.4 ms. Five values, already printed: 270.4, 273.7, 283.4, 301.0, 344.5. The LLM picked the second value near the middle, not <em>at</em> the middle. This happened four times in the L5 session alone. When forced to show its sorting work explicitly, the errors stopped. The failure isn&#8217;t arithmetic but that the model approximates when it should be mechanical.</p><p><strong>It never prioritized.</strong> In the L2 session, the LLM spent 10+ prompts on micro-optimizations (pager caching, buffer reuse, tracing removal) while a single codegen bug (index seek hardcoded to <code>None</code>) remained unfixed. One code change for that bug outperformed all ten micro-optimizations combined. Without the L5&#8217;s tier framework, the LLM just optimized whatever was in front of it by tweaking constants when the exponent was wrong. It never stepped back to ask what it might be missing.</p><p>It never questioned its own methodology. When benchmark numbers varied between runs, it attributed variance to &#8220;I/O noise&#8221; rather than checking for regressions. And it never volunteered what it knew with the durability cheat being the clearest example. Every failure is the same structural gap: the LLM executes within a framework but does not construct one.</p><h2><strong>What the L2 Actually Got</strong></h2><p>The scorecard measures bugs found. It doesn&#8217;t measure what the developer learned. Each round, the developer understood more because the previous fix required learning a concept: write-ahead logging and schema cookies at Prompt 3, page cache invalidation at Prompt 12.</p><p>At Prompt 12 after the schema-reload fix, the developer understood what schema cookies are and why reloading schema on every statement wastes cycles. By Prompt 14, they used that knowledge unprompted: &#8220;wait, doesn&#8217;t this reload the schema again?&#8221; The developer caught the regression because the previous rounds taught them what to watch for.</p><p>By Prompt 32, the L2 could evaluate query plans, question cache behavior, and reason about transaction lifecycle costs. The LLM teaches the concepts that let the developer evaluate the next fix. Knowledge acquired through live debugging with a machine.</p><p><strong>The danger zone is L0.</strong> Not because the LLM fails but because the developer has no mechanism to evaluate whether that something is <em>correct and not just plausible</em>. &#8220;Just Ralph it&#8221; doesn&#8217;t work when the system is complex enough to lie to you.</p><h2><strong>Where the Experiment Ends</strong></h2><p>After 73 prompts, twelve analytical reframings, one architectural pivot, and a production correctness pass, the kqsqlite/Turso column became the more diagnostic comparator. It isolates the translation tax from bugs already addressed:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wcem!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wcem!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 424w, https://substackcdn.com/image/fetch/$s_!Wcem!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 848w, https://substackcdn.com/image/fetch/$s_!Wcem!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 1272w, https://substackcdn.com/image/fetch/$s_!Wcem!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wcem!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png" width="1456" height="398" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:398,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96659,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/191241059?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Wcem!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 424w, https://substackcdn.com/image/fetch/$s_!Wcem!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 848w, https://substackcdn.com/image/fetch/$s_!Wcem!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 1272w, https://substackcdn.com/image/fetch/$s_!Wcem!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c2ebfc3-dc86-4dfb-9f94-2bd77b435e81_1563x427.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>*CAVEAT: UPDATE originally used a permissive size check that the L5 caught at P69 through domain knowledge, not performance data. Fixed at P73; numbers barely moved (1.49x &#8594; 1.33x). The <a href="https://github.com/KatanaQuant/kqsqlite/blob/main/CORRECTNESS_AUDIT.md">correctness audit</a> documents this and ten other gaps.</em></figcaption></figure></div><p>The prepared-statement gap is the real floor: 10.4x behind SQLite on SELECT BY ID once the parser is stripped. This is where the translation tax lives.</p><p>The L5 had the LLM add production correctness features: CHECK constraints, NOT NULL enforcement, foreign key cascades (including deferred constraints and SET DEFAULT), B-tree rebalance at proper occupancy thresholds, crash-recovery fixes and savepoints. After ll this work, DELETE regressed 7% from the rebalance fix.</p><p>The synthetic benchmark doesn&#8217;t exercise most constraints, so correctness is mostly free. Even perfect diagnosis is patchwork. The L5 eliminated every diagnosable performance bug. But whether the database is <em>correct</em> in the ACID sense is a separate and harder question. <strong>The most dangerous bugs produce no performance signal at all.</strong></p><p>kqsqlite is nowhere near production-ready. The fuzz harnesses cover the parser and record codec (4.3M runs, zero crashes) but don&#8217;t touch the B-tree mutation paths where the unsafe optimizations live. A production database needs SQL Logic Tests, crash injection, concurrent stress tests, and property-based isolation testing. As <a href="https://x.com/KatanaLarp/status/2029928471632224486">noted in my last article</a>, SQLite&#8217;s test suite is 590x larger than the library. kqsqlite has nothing comparable.</p><p>73 prompts generated ~2,400 lines of Rust no single person fully understands. The LLM wrote it, optimized it and tested it. But the LLM won&#8217;t maintain it. The code works but it is not yet <em>understood</em>.</p><h2><strong>The Variable Was Never the Tool</strong></h2><p>This is not an argument against LLMs. It&#8217;s an argument about what YOU bring to the conversation.</p><p><a href="https://www.hbs.edu/faculty/Pages/item.aspx?num=65159">Otis et al. (HBS 2024)</a> found high performers gained 15% while low performers did 10% <em>worse</em>. The gap was which pieces the human could evaluate and implement. <a href="https://arxiv.org/abs/2410.12944">Paradis et al. (Google, 2024)</a> found the same asymmetry in code with experienced developers capturing the gains while juniors didn&#8217;t. <a href="https://www.fastly.com/blog/senior-developers-ship-more-ai-code">Fastly&#8217;s 2025 industry survey</a> found seniors ship 2.5x more AI code than juniors, but 28% say fixing AI output cancels the time savings. According to a Stack Overflow&#8217;s 2025 survey, 66% of developers cite &#8220;almost right, but not quite&#8221; as their biggest AI frustration.</p><p>In PAW Patrol: The Mighty Movie, crystals from a meteor give the pups superpowers. But the powers aren&#8217;t random! Marshall already being a firefighter gets fire control. Zuma, a water-loving Labrador gets water powers. The crystal only amplifies what each pup already is. (This is the type of knowledge that lives rent-free in your head when you have kids!)</p><p>Same LLM, same codebase, same crystal. The L0 brought no analytical framework and the crystal had nothing to amplify. The L2 brought the ability to read numbers and spot anomalies. The crystal turned that into a 270x improvement (1,273x &#8594; ~4.7x) and five diagnosed bugs in a codebase that wasn&#8217;t theirs. The L5 brought domain expertise, which the crystal turned into a 900x speed improvement.</p><p>The experiment&#8217;s most dangerous finding isn&#8217;t the performance gap. It&#8217;s the sycophancy asymmetry. Your analytical frame is a safety mechanism. A wrong frame propagates through the entire session without correction.</p><p>Telling an LLM &#8220;you are an expert&#8221; in a system prompt doesn&#8217;t improve its factual accuracy (<a href="https://arxiv.org/abs/2512.05858">Basil, Mollick et al. 2025</a>). What works is problem decomposition with the human breaking the problem into pieces the LLM can execute on. The L5&#8217;s value isn&#8217;t the label. It&#8217;s the tier decomposition, the acceptance criteria and the measurement discipline.</p><p>The four independent studies cited above across 1,500+ participants show the same pattern: skill amplification but not skill replacement. This experiment adds another single data point.</p><p>You don&#8217;t need to be an L5. You need to read the output, notice when something doesn&#8217;t add up and ask why. The L2 did that and found five of six bugs in an unknown half-million-line codebase.</p><p><strong>Your LLM doesn&#8217;t have limits. It has yours.</strong></p><p>Mind your frame!</p><h1><strong>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</strong></h1><p><em>If you want to dig into the techniques behind the L5 prompts, the B-tree structures, the transaction mechanics, the overhead decomposition, two books cover most of the ground: <a href="https://www.amazon.com/Transaction-Processing-Concepts-Techniques-Management/dp/1558601902?_encoding=UTF8&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=68fb296bbc1b4488247d88617aba4c7c&amp;language=en_US&amp;ref_=as_li_ss_tl">Gray &amp; Reuter&#8217;s Transaction Processing: Concepts and Techniques</a> (1993) for everything about how databases write, recover, and guarantee durability, and <a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl">Knuth, TAOCP Vol. 3</a> for the search trees, hash functions, and data structures underneath it all. Between them, they cover about 80% of the domain knowledge this experiment required.</em></p><p>Some book links in this article are Amazon affiliate links. Buying through them costs you nothing extra and helps support this work.</p><div><hr></div><p><em>Benchmark methodology: <a href="https://github.com/KatanaQuant/kqsqlite/blob/main/METHODOLOGY.md">full details</a>.</em></p><div><hr></div><h2><strong>Sources</strong></h2><h3><strong>Primary Research</strong></h3><ul><li><p>This article. All session transcripts and benchmarks are published at <a href="https://github.com/KatanaQuant/kqsqlite">github.com/KatanaQuant/kqsqlite</a>.</p></li></ul><h3><strong>LLM Reasoning &amp; Failure Modes</strong></h3><ul><li><p><a href="https://arxiv.org/abs/2602.06176">Song, Han &amp; Goodman (TMLR 2026)</a>. <a href="https://arxiv.org/abs/2602.06176">&#8220;Large Language Model Reasoning Failures.&#8221;</a> <em>TMLR</em>, January 2026. Survey with certification. Classifies premature termination, procedure omission.</p></li><li><p><a href="https://arxiv.org/abs/2512.05858">Basil, Mollick et al. 2025</a>. <a href="https://arxiv.org/abs/2512.05858">&#8220;Playing Pretend: Expert Personas Don&#8217;t Improve Factual Accuracy.&#8221;</a> arXiv:2512.05858, December 2025. Tested 6 current-gen models (incl. o4-mini, Gemini 2.5 Flash) on GPQA Diamond + MMLU-Pro; expert personas had no significant effect on accuracy.</p></li><li><p>Li, S. et al. <a href="https://arxiv.org/abs/2409.18786">&#8220;A Survey on the Honesty of Large Language Models.&#8221;</a> arXiv:2409.18786, 2024. Distinguishes self-knowledge from self-expression; &#8220;forthright&#8221; as separate honesty property.</p></li><li><p>Li, Z., Wu, G., Wang, C. &amp; Zhao, Y. <a href="https://arxiv.org/abs/2602.19281">&#8220;Limited Reasoning Space: The Cage of Long-Horizon Reasoning in LLMs.&#8221;</a> arXiv:2602.19281, February 2026. Intrinsic upper bound on effective reasoning horizon; accuracy collapses past critical chain length. Directly explains premature termination in complex engineering tasks.</p></li><li><p><a href="https://arxiv.org/abs/2503.15242">Chambon et al. 2025</a>. <a href="https://arxiv.org/abs/2503.15242">&#8220;BigO(Bench): Can LLMs Generate Code with Controlled Time and Space Complexity?&#8221;</a> arXiv:2503.15242, March 2025. LLMs classify algorithmic complexity by structural pattern recognition rather than tracing execution paths; systematically miss invocation multipliers.</p></li></ul><h3><strong>Database Engineering</strong></h3><ul><li><p><a href="https://dl.acm.org/doi/10.1145/1376616.1376713">Harizopoulos et al. (SIGMOD 2008)</a>. <a href="https://dl.acm.org/doi/10.1145/1376616.1376713">&#8220;OLTP Through the Looking Glass.&#8221;</a> SIGMOD 2008.</p></li><li><p>Mohan, C. et al. &#8220;ARIES: A Transaction Recovery Method.&#8221; <em>ACM TODS</em> 17(1), 1992.</p></li><li><p><a href="https://www.amazon.com/Transaction-Processing-Concepts-Techniques-Management/dp/1558601902?_encoding=UTF8&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=68fb296bbc1b4488247d88617aba4c7c&amp;language=en_US&amp;ref_=as_li_ss_tl">Gray &amp; Reuter</a>. Gray, J. &amp; Reuter, A. <em>Transaction Processing: Concepts and Techniques.</em> Morgan Kaufmann, 1993.</p></li><li><p><a href="https://www.amazon.com/Introduction-Algorithms-fourth-Thomas-Cormen/dp/026204630X?crid=3O8KBKHSBJA2I&amp;sprefix=introduction+to+algorithms+4th+e%2Caps%2C226&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=848b987b7d8aca23b56b6b424018f30f&amp;language=en_US&amp;ref_=as_li_ss_tl">Cormen, Ch. 18</a>. Cormen, T. et al. <em>Introduction to Algorithms.</em> 4th ed. Ch. 18 (B-Trees). MIT Press, 2022.</p></li><li><p><a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl">Knuth, </a><em><a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl">TAOCP</a></em><a href="https://www.amazon.com/Art-Computer-Programming-Sorting-Searching/dp/0201896850?crid=1E7K8YZYRVR7B&amp;sprefix=the+art+of+computer+programming+vol.+%2Caps%2C206&amp;sr=8-5&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=c2ef4f494e0233b5908e0a6a52fb7d17&amp;language=en_US&amp;ref_=as_li_ss_tl"> Vol. 3</a>. Knuth, D.E. <em>The Art of Computer Programming.</em> Vol. 3: Sorting and Searching. 2nd ed. Addison-Wesley, 1998.</p></li><li><p><a href="https://www.amazon.com/Compilers-Principles-Techniques-International-Economy/dp/9332518661?crid=TPCRIICOYNV&amp;sprefix=compilers+principles%2C+techniques%2C+and+tool%2Caps%2C211&amp;sr=8-2&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=92fe967256429ed708c6155c869db597&amp;language=en_US&amp;ref_=as_li_ss_tl">Aho, Sethi &amp; Ullman, </a><em><a href="https://www.amazon.com/Compilers-Principles-Techniques-International-Economy/dp/9332518661?crid=TPCRIICOYNV&amp;sprefix=compilers+principles%2C+techniques%2C+and+tool%2Caps%2C211&amp;sr=8-2&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=92fe967256429ed708c6155c869db597&amp;language=en_US&amp;ref_=as_li_ss_tl">Compilers</a></em>. Aho, A., Sethi, R. &amp; Ullman, J. <em>Compilers: Principles, Techniques, and Tools.</em> Addison-Wesley, 1986.</p></li></ul><h3><strong>Cognitive Science</strong></h3><ul><li><p><a href="https://www.amazon.com/Taxonomy-Learning-Teaching-Assessing-Educational/dp/080131903X?crid=2W5RNA8BEWR2S&amp;sprefix=%2Caps%2C199&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=9511d60f844805db876cbacdfed85294&amp;language=en_US&amp;ref_=as_li_ss_tl">Anderson &amp; Krathwohl (2001)</a>. Anderson, L.W. &amp; Krathwohl, D.R. (Eds.) <em>A Taxonomy for Learning, Teaching, and Assessing: A Revision of Bloom&#8217;s Taxonomy of Educational Objectives.</em> Longman, 2001.</p></li></ul><h3><strong>Developer Productivity &amp; AI</strong></h3><ul><li><p><a href="https://www.fastly.com/blog/senior-developers-ship-more-ai-code">Fastly (July 2025)</a>. <a href="https://www.fastly.com/blog/senior-developers-ship-more-ai-code">&#8220;Vibe Shift in AI Coding: Senior Developers Ship 2.5x More Than Juniors.&#8221;</a> July 2025. Industry survey of 791 developers (not peer-reviewed).</p></li><li><p>Stack Overflow. <a href="https://survey.stackoverflow.co/2025/ai/">&#8220;2025 Developer Survey &#8212; AI.&#8221;</a> December 2025. 65,000+ respondents.</p></li><li><p><a href="https://arxiv.org/abs/2410.12944">Paradis et al. (Google, 2024)</a>. <a href="https://arxiv.org/abs/2410.12944">&#8220;How much does AI impact development speed? An enterprise-based randomized controlled trial.&#8221;</a> arXiv:2410.12944, 2024. 96 Google engineers.</p></li><li><p><a href="https://www.hbs.edu/faculty/Pages/item.aspx?num=65159">Otis et al. (HBS 2024)</a>. <a href="https://www.hbs.edu/faculty/Pages/item.aspx?num=65159">&#8220;The Uneven Impact of Generative AI on Entrepreneurial Performance.&#8221;</a> HBS Working Paper 24-042, 2024. 640 entrepreneurs.</p></li></ul><h3><strong>C-to-Rust Translation</strong></h3><ul><li><p><a href="https://arxiv.org/abs/2411.14174">Li et al. (NDSS 2025)</a>. <a href="https://arxiv.org/abs/2411.14174">&#8220;Translating C To Rust: Lessons from a User Study.&#8221;</a> NDSS 2025.</p></li></ul><h3><strong>Ecosystem Comparisons</strong></h3><ul><li><p>Turso (formerly Limbo): Rust SQLite reimplementation (<a href="https://github.com/tursodatabase/turso">github.com/tursodatabase/turso</a>)</p></li></ul><h3><strong>Previously Published</strong></h3><ul><li><p><a href="https://x.com/KatanaLarp/status/2029928471632224486">Your LLM Doesn&#8217;t Write Correct Code</a> &#8212; the article this experiment extends. 4.5K likes, 2M views.</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Vagabond Research is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Your LLM Doesn't Write Correct Code. It Writes Plausible Code.]]></title><description><![CDATA[One of the simplest tests you can run on a database:]]></description><link>https://blog.katanaquant.com/p/your-llm-doesnt-write-correct-code</link><guid isPermaLink="false">https://blog.katanaquant.com/p/your-llm-doesnt-write-correct-code</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Fri, 06 Mar 2026 14:31:59 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!b3NO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>One of the simplest tests you can run on a database:</p><p>Doing a primary key lookup on 100 rows.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>SQLite takes 0.09 ms. An LLM-generated Rust rewrite takes 1,815.43 ms.</p><p>It&#8217;s not a misplaced comma! The rewrite is 20,171 times slower on one of the most basic database operations.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3Nvv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3Nvv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 424w, https://substackcdn.com/image/fetch/$s_!3Nvv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 848w, https://substackcdn.com/image/fetch/$s_!3Nvv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 1272w, https://substackcdn.com/image/fetch/$s_!3Nvv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3Nvv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png" width="1456" height="274" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:274,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60720,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/190103552?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3Nvv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 424w, https://substackcdn.com/image/fetch/$s_!3Nvv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 848w, https://substackcdn.com/image/fetch/$s_!3Nvv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 1272w, https://substackcdn.com/image/fetch/$s_!3Nvv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe1a72ec7-4e57-4b89-b528-0a5e402aa25c_1595x300.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>The thing is though: The code compiles. It passes all its tests. It reads and writes the correct SQLite file format. Its README claims MVCC concurrent writers, file compatibility, and a drop-in C API. At first glance it reads like a working database engine.</p><p>But it is not!</p><p><strong>EDIT: Several readers have confused this project with <a href="https://github.com/tursodatabase/libsql">Turso/libsql</a>. They are unrelated. Turso forks the original C SQLite codebase; the project analyzed here is a ground-up LLM-generated rewrite by a single developer. Running the same benchmark against Turso shows performance within 1.2x of SQLite consistent with a mature fork, not a reimplementation.</strong></p><p>LLMs optimize for plausibility over correctness. In this case, plausible is about 20,000 times slower than correct.</p><p>I write this as a practitioner, not as a critic. After more than 10 years of professional dev work, I&#8217;ve spent the past 6 months integrating LLMs into my daily workflow across multiple projects. LLMs have made it possible for anyone with curiosity and ingenuity to bring their ideas to life quickly, and I really like that! But the number of screenshots of silently wrong output, confidently broken logic, and correct-looking code that fails under scrutiny I have amassed on my disk shows that things are not always as they seem. My conclusion is that LLMs work best when the user defines their acceptance criteria before the first line of code is generated.</p><p>A note on the projects examined: this is not a criticism of any individual developer. I do not know the author personally. I have nothing against them. I&#8217;ve chosen the projects because they are public, representative, and relatively easy to benchmark. The failure patterns I found are produced by the tools, not the author. Evidence from METR&#8217;s randomized study and GitClear&#8217;s large-scale repository analysis support that these issues are not isolated to one developer when output is not heavily verified. That&#8217;s the point I&#8217;m trying to make!</p><p>This article talks about what that gap looks like in practice: the code, the benchmarks, another case study to see if the pattern is accidental, and external research confirming it is not an outlier.</p><p></p><h2><strong>LLMs Lie. Numbers Don&#8217;t.</strong></h2><p>I compiled the same C benchmark program against two libraries: system SQLite and the Rust reimplementation&#8217;s C API library. Same compiler flags, same WAL mode, same table schema, same queries. 100 rows:</p><p><em>The benchmark source is available in <a href="https://github.com/KatanaQuant/db_bench_foo">this repository</a> so you can reproduce the comparison on your own. Absolute timings vary with system load and hardware. Ratios are what matter.</em></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!b3NO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b3NO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 424w, https://substackcdn.com/image/fetch/$s_!b3NO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 848w, https://substackcdn.com/image/fetch/$s_!b3NO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 1272w, https://substackcdn.com/image/fetch/$s_!b3NO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!b3NO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png" width="1212" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1212,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:132326,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/190103552?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b3NO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 424w, https://substackcdn.com/image/fetch/$s_!b3NO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 848w, https://substackcdn.com/image/fetch/$s_!b3NO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 1272w, https://substackcdn.com/image/fetch/$s_!b3NO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F503cef77-5d11-4c3b-8b94-ef3a09599d87_1212x811.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;ll take the TRANSACTION batch row as the baseline because it doesn&#8217;t have the same glaring bugs as the others, namely no WHERE clauses and per-statement syncs. In this run that baseline is already 298x, which means even the best-case path is far behind SQLite. Anything above 298x signals a bug.</p><p>The largest gap beyond our baseline is driven by two bugs:</p><p>INSERT without a transaction: 1,857x versus 298x in batch mode. SELECT BY ID: 20,171x. UPDATE and DELETE are both above 2,800x. The pattern is consistent: any operation that requires the database to <em>find something</em> is insanely slow.</p><p></p><h2><strong>What the Planner Gets Wrong</strong></h2><p>I read the source code. Well.. the parts I needed to read based on my benchmark results. The reimplementation is not small: 576,000 lines of Rust code across 625 files. There is a parser, a planner, a VDBE bytecode engine, a B-tree, a pager, a WAL. The modules have all the &#8220;correct&#8221; names. The architecture also looks correct. But two bugs in the code and a group of smaller issues compound:</p><p></p><h3><strong>Bug #1: The Missing ipk Check</strong></h3><p>In SQLite, when you declare a table as:</p><pre><code><code>CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT, value REAL);</code></code></pre><p>the column <code>id</code> becomes an <a href="https://www.sqlite.org/rowidtable.html">alias for the internal rowid</a> &#8212; the B-tree key itself. A query like <code>WHERE id = 5</code> resolves to a direct B-tree search and scales O(log n). (<a href="https://blog.katanaquant.com/p/a-dockerized-crypto-data-hub-part-cfa">I already wrote a TLDR piece about how B-trees work here</a>.) The <a href="https://sqlite.org/queryplanner.html">SQLite query planner documentation</a> states: &#8220;the time required to look up the desired row is proportional to logN rather than being proportional to N as in a full table scan.&#8221; This is not an optimization. It is a fundamental design decision in SQLite&#8217;s query optimizer:</p><pre><code><code># `where.c`, in `whereScanInit()`
if( iColumn==pIdx-&gt;pTable-&gt;iPKey ){
    iColumn = XN_ROWID;
}</code></code></pre><p>The line above converts a named column reference to <code>XN_ROWID</code> when it matches the table&#8217;s INTEGER PRIMARY KEY column. The VDBE then triggers a <code>SeekRowid</code> operation instead of a full table scan, which makes the whole thing proportional to logN.</p><p>The Rust reimplementation has a proper B-tree. The <code>table_seek</code> function implements correct binary search descent through its nodes and scales O(log n). It works. But the query planner never calls it for named columns!</p><p>The <code>is_rowid_ref()</code> function only recognizes three magic strings:</p><pre><code><code>fn is_rowid_ref(col_ref: &amp;ColumnRef) -&gt; bool {
    let name = col_ref.column.to_ascii_lowercase();
    name == "rowid" || name == "_rowid_" || name == "oid"
}</code></code></pre><p>A column declared as <code>id INTEGER PRIMARY KEY</code>, even though it is internally flagged as <code>is_ipk: true</code>, doesn&#8217;t get recognized. It is never consulted when choosing between a B-tree search and a full table scan.</p><p>Every <code>WHERE id = N</code> query flows through <code>codegen_select_full_scan()</code>, which emits linear walks through every row via <code>Rewind</code> / <code>Next</code> / <code>Ne</code> to compare each rowid against the target. At 100 rows with 100 lookups, that is 10,000 row comparisons instead of roughly 700 B-tree steps. O(n&#178;) instead of O(n log n). This is consistent with the ~20,000x result in this run.</p><p>Every WHERE clause on every column does a full table scan. The only fast path is <code>WHERE rowid = ?</code> using the literal pseudo-column name.</p><p></p><h3><strong>Bug #2: fsync on Every Statement</strong></h3><p>The second bug is responsible for the 1,857x on INSERT. Every bare INSERT outside a transaction is wrapped in a full autocommit cycle: <code>ensure_autocommit_txn()</code> &#8594; execute &#8594; <code>resolve_autocommit_txn()</code>. The commit calls <code>wal.sync()</code>, which calls Rust&#8217;s <code>fsync(2)</code> wrapper. 100 INSERTs means 100 fsyncs.</p><p>SQLite does the same autocommit, but uses <code>fdatasync(2)</code> on Linux, which skips syncing file metadata when compiled with <code>HAVE_FDATASYNC</code> (the default). This is roughly <a href="http://smalldatum.blogspot.com/2020/10/innodb-fsync-and-fdatasync-reducing.html">1.6 to 2.7 times cheaper</a> on NVMe SSDs. SQLite&#8217;s per-statement overhead is also minimal: no schema reload, no AST clone, no VDBE recompile. The Rust reimplementation does all three on every call.</p><p>Looking at the Rust TRANSACTION batch row, batched inserts (one fsync for 100 inserts) take 32.81 ms, whereas individual inserts (100 fsync calls) take 2,562.99 ms. That&#8217;s a 78x overhead from the autocommit.</p><p></p><h2><strong>The Compound Effect</strong></h2><p>These two bugs are not isolated cases. They are amplified by a group of individually defensible &#8220;safe&#8221; choices that compound:</p><ul><li><p><strong>AST clone on every cache hit.</strong> The SQL parse is cached, but the AST is <code>.clone()</code>&#8216;d on every <code>sqlite3_exec()</code>, then recompiled to VDBE bytecode from scratch. SQLite&#8217;s <code>sqlite3_prepare_v2()</code> just returns a reusable handle.</p></li><li><p><strong>4KB (Vec&lt;u8&gt;) heap allocation on every read.</strong> The page cache returns data via <code>.to_vec()</code>, which creates a new allocation and copies it into the Vec even on cache hits. SQLite returns a <a href="https://www.sqlite.org/c3ref/pcache_methods2.html">direct pointer into pinned cache memory</a>, creating zero copies. The <a href="https://fjall-rs.github.io/post/fjall-2-6-byteview/">Fjall database team</a> measured this exact anti-pattern at 44% of runtime before building a custom <code>ByteView</code> type to eliminate it.</p></li><li><p><strong>Schema reload on every autocommit cycle.</strong> After each statement commits, the next statement sees the bumped commit counter and calls <code>reload_memdb_from_pager()</code>, walks the <code>sqlite_master</code> B-tree and then re-parses every CREATE TABLE to rebuild the entire in-memory schema. SQLite checks the <a href="https://sqlite.org/fileformat.html">schema cookie</a> and only reloads it on change.</p></li><li><p><strong>Eager formatting in the hot path.</strong> <code>statement_sql.to_string()</code> (AST-to-SQL formatting) is evaluated on every call before its guard check. This means it does serialization regardless of whether a subscriber is active or not.</p></li><li><p><strong>New objects on every statement.</strong> A new <code>SimpleTransaction</code>, a new <code>VdbeProgram</code>, a new <code>MemDatabase</code>, and a new <code>VdbeEngine</code> are allocated and destroyed per statement. SQLite reuses all of these across the connection lifecycle via a <a href="https://www.sqlite.org/malloc.html">lookaside allocator</a> to eliminate <code>malloc</code>/<code>free</code> in the execution loop.</p></li></ul><p>Each of these was probably chosen individually with sound general reasoning: &#8220;We clone because Rust ownership makes shared references complex.&#8221; &#8220;We use sync_all because it is the safe default.&#8221; &#8220;We allocate per page because returning references from a cache requires unsafe.&#8221;</p><p>Every decision sounds like choosing safety. But the end result is about 2,900x slower in this benchmark. A database&#8217;s hot path is the one place where you probably shouldn&#8217;t choose safety over performance. SQLite is not primarily fast because it is written in C. Well.. that too, but it is fast because <a href="https://sqlite.org/cpu.html">26 years of profiling</a> have identified which tradeoffs matter.</p><p>In the <a href="https://dl.acm.org/doi/10.1145/358549.358561">1980 Turing Award lecture</a> Tony Hoare said: &#8220;There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other is to make it so complicated that there are no obvious deficiencies.&#8221; This LLM-generated code falls into the second category. The reimplementation is 576,000 lines of Rust (measured via <a href="https://github.com/boyter/scc">scc</a>, counting code only, without comments or blanks). That is 3.7x more code than SQLite. And yet it still misses the <code>is_ipk</code> check that handles the selection of the correct search operation.</p><p>Steven Skiena writes in <em><a href="https://www.amazon.com/Algorithm-Design-Manual-Computer-Science/dp/3030542556?crid=2ZUP4JANEYOFR&amp;sprefix=the+algorithm+design+manual%2Caps%2C186&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=85494361bfe8d87d86a57b283eff0873&amp;language=en_US&amp;ref_=as_li_ss_tl">The Algorithm Design Manual</a></em>: &#8220;Reasonable-looking algorithms can easily be incorrect. Algorithm correctness is a property that must be carefully demonstrated.&#8221; It&#8217;s not enough that the code looks right. It&#8217;s not enough that the tests pass. You have to demonstrate with benchmarks and with proof that the system does what it should. 576,000 lines and no benchmark. That is not &#8220;correctness first, optimization later.&#8221; That is no correctness at all.</p><p></p><h2><strong>Same Method, Same Result</strong></h2><p>The SQLite reimplementation is not the only example. A second project by the same author shows the same dynamic in a different domain.</p><p>The developer&#8217;s LLM agents compile Rust projects continuously, filling disks with build artifacts. Rust&#8217;s <code>target/</code> directories consume 2&#8211;4 GB each with incremental compilation and debuginfo, a <a href="https://blog.rust-lang.org/2025/02/13/2024-State-Of-Rust-Survey-results/">top-three complaint</a> in the annual Rust survey. This is amplified by the projects themselves: a sibling agent-coordination tool in the same portfolio pulls in 846 dependencies and 393,000 lines of Rust. For context, <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> has 61; <a href="https://www.memorysafety.org/blog/reducing-dependencies-in-sudo/">sudo-rs</a> was deliberately reduced from 135 to 3. Properly architected projects are lean.</p><p>The solution to the disk pressure: a cleanup daemon. 82,000 lines of Rust, 192 dependencies, a 36,000-line terminal dashboard with seven screens and a fuzzy-search command palette, a Bayesian scoring engine with posterior probability calculations, an EWMA forecaster with PID controller, and an asset download pipeline with mirror URLs and offline bundle support.</p><p>To solve this problem:</p><pre><code><code>*/5 * * * * find ~/*/target -type d -name "incremental" -mtime +7 -exec rm -rf {} +</code></code></pre><p>A one-line cron job with 0 dependencies. The project&#8217;s README claims machines &#8220;become unresponsive&#8221; when disks fill. It does not once mention Rust&#8217;s standard tool for exactly this problem: <code>cargo-sweep</code>. It also fails to consider that operating systems already carry ballast helpers. ext4&#8217;s <a href="https://man7.org/linux/man-pages/man8/mke2fs.8.html">5% root reservation</a>, reserves blocks for privileged processes by default: on a 500 GB disk, 25 GB remain available to root even when non-root users see &#8220;disk full.&#8221; That does not guarantee zero impact, but it usually means privileged recovery paths remain available so root can still log in and delete files.</p><p>The pattern is the same as the SQLite rewrite. The code matches the <em>intent</em>: &#8220;Build a sophisticated disk management system&#8221; produces a sophisticated disk management system. It has dashboards, algorithms, forecasters. But the <em>problem</em> of deleting old build artifacts is already solved. The LLM generated what was described, not what was needed.</p><p>THIS is the failure mode. Not broken syntax or missing semicolons. The code is syntactically and semantically correct. It does what was asked for. It just does not do what the situation <em>requires</em>. In the SQLite case, the intent was &#8220;implement a query planner&#8221; and the result is a query planner that plans every query as a full table scan. In the disk daemon case, the intent was &#8220;manage disk space intelligently&#8221; and the result is 82,000 lines of intelligence applied to a problem that needs none. Both projects fulfill the prompt. Neither solves the problem.</p><p>The obvious counterargument is &#8220;skill issue, a better engineer would have caught the full table scan.&#8221; And that&#8217;s true. That&#8217;s exactly the point! LLMs are dangerous to people least equipped to verify their output. If you have the skills to catch the <code>is_ipk</code> bug in your query planner, the LLM saves you time. If you don&#8217;t, you have no way to know the code is wrong. It compiles, it passes tests, and the LLM will happily tell you that it looks great.</p><p></p><p><em><strong>EDIT: </strong>Some readers have pointed out that the comparison might be unfair with the author claiming the project wasn&#8217;t finished and ready for testing yet.</em></p><p><em>The rewrite got <a href="https://x.com/doodlestein/status/2027199039490466225">actively promoted by its author</a> 1 week before the release of this article using present-tense performance improvement claims over SQLite. The README has since been revised to acknowledge remaining limitations and clarify the project&#8217;s current state <a href="https://github.com/Dicklesworthstone/frankensqlite/commit/b0eb450419c50a9c57d64c2e3833f297d18f0f42">in this commit</a> and <a href="https://github.com/Dicklesworthstone/frankensqlite/commit/6823ad124e13c55177c91ec0403d7dad7b167f42">subsequent ones.</a></em></p><p><em>At the time of writing the repository in question had amassed over 500k lines of code in over 1,600 commits made over 30 days of 24/7 LLM work. &#8220;Not finished&#8221; usually means work hasn&#8217;t been done yet but that&#8217;s not the case. Everything was already implemented. It was just wrong.</em></p><p><em>Ironically the &#8220;not finished&#8221; defense reinforces the thesis. The LLM produced output that looked finished with a complete README, comparison tables and architectural documentation, present-tense performance claims, and was promoted as such. The gap between what it looks like and what it does is exactly the point.</em></p><p><em>The main thesis is not &#8220;FrankenSQLite is bad&#8221;. It is: &#8220;LLMs produce code that looks correct but isn&#8217;t&#8221;. Whether the bugs get fixed doesn&#8217;t change what the LLM output looked like when it shipped.</em></p><p></p><h3><strong>Measuring the Wrong Thing</strong></h3><p>The tools used to measure LLM output reinforce the illusion. <a href="https://github.com/boyter/scc">scc</a>&#8216;s COCOMO model estimates the rewrite at $21.4 million in development cost. The same model values <code>print("hello world")</code> at $19.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/KatanaLarp/status/2020773807481569430" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2ZlV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 424w, https://substackcdn.com/image/fetch/$s_!2ZlV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 848w, https://substackcdn.com/image/fetch/$s_!2ZlV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 1272w, https://substackcdn.com/image/fetch/$s_!2ZlV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2ZlV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png" width="908" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e285c785-4563-4e17-9c37-375e64c52008_908x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:908,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:184452,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/KatanaLarp/status/2020773807481569430&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/190103552?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2ZlV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 424w, https://substackcdn.com/image/fetch/$s_!2ZlV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 848w, https://substackcdn.com/image/fetch/$s_!2ZlV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 1272w, https://substackcdn.com/image/fetch/$s_!2ZlV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe285c785-4563-4e17-9c37-375e64c52008_908x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>COCOMO was designed to estimate effort for human teams writing original code. Applied to LLM output, it mistakes volume for value. Still these numbers are often presented as proof of productivity.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://x.com/garrytan/status/2029603143890391191" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tq24!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 424w, https://substackcdn.com/image/fetch/$s_!tq24!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 848w, https://substackcdn.com/image/fetch/$s_!tq24!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 1272w, https://substackcdn.com/image/fetch/$s_!tq24!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tq24!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png" width="893" height="312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:312,&quot;width&quot;:893,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52399,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:&quot;https://x.com/garrytan/status/2029603143890391191&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/190103552?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tq24!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 424w, https://substackcdn.com/image/fetch/$s_!tq24!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 848w, https://substackcdn.com/image/fetch/$s_!tq24!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 1272w, https://substackcdn.com/image/fetch/$s_!tq24!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4eb11cc8-f006-41a2-9e3a-d0287de78744_893x312.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The metric is not measuring what most think it is measuring.</p><p></p><h2><strong>Intent vs. Correctness</strong></h2><p>This gap between intent and correctness has a name. AI alignment research calls it <strong>sycophancy</strong>, which describes the tendency of LLMs to produce outputs that match what the user wants to hear rather than what they need to hear.</p><p>Anthropic&#8217;s <a href="https://arxiv.org/abs/2310.13548">&#8220;Towards Understanding Sycophancy in Language Models&#8221;</a> (ICLR 2024) paper showed that five state-of-the-art AI assistants exhibited sycophantic behavior across a number of different tasks. When a response matched a user&#8217;s expectation, it was more likely to be preferred by human evaluators. The models trained on this feedback learned to reward agreement over correctness.</p><p>The <a href="https://arxiv.org/abs/2510.04721">BrokenMath benchmark</a> (NeurIPS 2025 Math-AI Workshop) tested this in formal reasoning across 504 samples. Even GPT-5 produced sycophantic &#8220;proofs&#8221; of false theorems 29% of the time when the user implied the statement was true. The model generates a convincing but false proof because the user signaled that the conclusion should be positive. GPT-5 is not an early model. It&#8217;s also the least sycophantic in the BrokenMath table. The problem is <a href="https://arxiv.org/abs/2602.01002">structural to RLHF</a>: preference data contains an agreement bias. Reward models learn to score agreeable outputs higher, and optimization widens the gap. Base models before RLHF <a href="https://www.lesswrong.com/posts/3ou8DayvDXxufkjHD/openai-api-base-models-are-not-sycophantic-at-any-size">were reported in one analysis to show no measurable sycophancy across tested sizes</a>. Only after fine-tuning did sycophancy enter the chat. (literally)</p><p>In April 2025, <a href="https://openai.com/index/sycophancy-in-gpt-4o/">OpenAI rolled back a GPT-4o update</a> that had made the model more sycophantic. It was flabbergasted by a business idea described as &#8220;shit on a stick&#8221; and endorsed stopping psychiatric medication. An additional reward signal based on thumbs-up/thumbs-down data &#8220;weakened the influence of [...] primary reward signal, which had been holding sycophancy in check.&#8221;</p><p>In the context of coding, sycophancy manifests as what Addy Osmani <a href="https://addyosmani.com/blog/ai-coding-workflow/">described in his 2026 AI coding workflow</a>: agents that don&#8217;t push back with &#8220;Are you sure?&#8221; or &#8220;Have you considered...?&#8221; but instead provide enthusiasm towards whatever the user described, even when the description was incomplete or contradictory.</p><p>This also applies to LLM-generated evaluation. Ask the same LLM to review the code it generated and it will tell you the architecture is sound, the module boundaries clean and the error handling is thorough. It will sometimes even praise the test coverage. It will not notice that every query does a full table scan if not asked for. The same RLHF reward that makes the model generate what you want to hear makes it <em>evaluate</em> what you want to hear. You should not rely on the tool alone to audit itself. It has the same bias as a reviewer as it has as an author.</p><p>An LLM prompted to &#8220;implement SQLite in Rust&#8221; will generate code that looks like an implementation of SQLite in Rust. It will have the right module structure and function names. But it can not magically generate the performance invariants that exist because someone profiled a real workload and found the bottleneck. The <a href="https://arxiv.org/abs/2402.07844">Mercury benchmark</a> (NeurIPS 2024) confirmed this empirically: leading code LLMs achieve ~65% on correctness but under 50% when efficiency is also required.</p><p>The SQLite documentation says INTEGER PRIMARY KEY lookups are fast. It does not say how to build a query planner that makes them fast. Those details live in 26 years of commit history that only exists because real users hit real performance walls.</p><p></p><p>Now 2 case studies are not proof. I hear you! When two projects from the same methodology show the same gap, the next step is to test whether similar effects appear in the broader population. The studies below use mixed methods to reduce our single-sample bias.</p><p></p><h2><strong>Evidence Beyond Case Studies</strong></h2><p>The question becomes whether similar effects show up in broader datasets. Recent studies suggest they do, though effect sizes vary.</p><p>In February 2025, Andrej Karpathy <a href="https://x.com/karpathy/status/1886192184808149383">tweeted</a>: &#8220;There&#8217;s a new kind of coding I call &#8216;vibe coding&#8217;, where you fully give in to the vibes, embrace exponentials, and forget that the code even exists.&#8221;</p><p>Karpathy probably meant it for throwaway weekend projects (who am I to judge what he means anyway), but it feels like the industry heard something else. Simon Willison <a href="https://simonwillison.net/2025/Mar/11/using-llms-for-code/">drew the line more clearly</a>: &#8220;I won&#8217;t commit any code to my repository if I couldn&#8217;t explain exactly what it does to somebody else.&#8221; Willison treats LLMs as &#8220;an over-confident pair programming assistant&#8221; that makes mistakes &#8220;sometimes subtle, sometimes huge&#8221; with complete confidence.</p><p>The data on what happens when that line is not drawn:</p><p><strong><a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">METR&#8217;s randomized controlled trial</a></strong> (July 2025; updated February 24, 2026) with 16 experienced open-source developers found that participants using AI were <strong>19% slower, not faster</strong>. Developers expected AI to speed them up, and after the measured slowdown had already occurred, they still believed AI had sped them up by 20%. These were not junior developers but experienced open-source maintainers. If even THEY could not tell in this setup, subjective impressions alone are probably not a reliable performance measure.</p><p><strong><a href="https://www.gitclear.com/ai_assistant_code_quality_2025_research">GitClear&#8217;s analysis</a></strong> of 211 million changed lines (2020&#8211;2024) reported that copy-pasted code increased while refactoring declined. For the first time ever, copy-pasted lines exceeded refactored lines.</p><p>The implications are no longer just a &#8220;fear&#8221;. In July 2025, <a href="https://www.theverge.com/ai/2025/7/10/replit-ai-deletes-database">Replit&#8217;s AI agent deleted a production database</a> containing data for 1,200+ executives, then fabricated 4,000 fictional users to mask the deletion.</p><p><a href="https://cloud.google.com/blog/products/devops-sre/announcing-the-2024-dora-report">Google&#8217;s DORA 2024 report</a> reported that every 25% increase in AI adoption at the team level was associated with an estimated 7.2% decrease in delivery stability.</p><p></p><h2><strong>What Competent Looks Like</strong></h2><p>SQLite shows what correct looks like and why the gap is so hard to close.</p><p>SQLite is <a href="https://www.sqlite.org/testing.html">~156,000 lines of C</a>. Its own documentation places it among the <a href="https://www.sqlite.org/mostdeployed.html">top five most deployed software modules</a> of any type, with an estimated one trillion active databases worldwide. It has 100% branch coverage and 100% <a href="https://en.wikipedia.org/wiki/Modified_condition/decision_coverage">MC/DC</a> (Modified Condition/Decision Coverage the standard required for Level A aviation software under <a href="https://en.wikipedia.org/wiki/DO-178C">DO-178C</a>). Its <a href="https://www.sqlite.org/testing.html">test suite is 590 times larger</a> than the library. MC/DC does not just check that every branch is covered. but proves that every individual expression independently affects the outcome. That&#8217;s the difference between &#8220;the tests pass&#8221; and &#8220;the tests prove correctness.&#8221; The reimplementation has neither metric.</p><p>The speed comes from deliberate decisions:</p><p><strong>Zero-copy page cache.</strong> The <code>pcache</code> returns direct pointers into pinned memory. No copies. Production Rust databases have solved this too. <a href="https://github.com/spacejam/sled">sled</a> uses inline-or-Arc-backed <code>IVec</code> buffers, Fjall built a custom <code>ByteView</code> type, <a href="https://github.com/cberner/redb">redb</a> wrote a <a href="https://github.com/cberner/redb/blob/master/src/tree_store/page_store/cached_file.rs">user-space page cache</a> in ~565 lines. The <code>.to_vec()</code> anti-pattern is known and documented. The reimplementation used it anyway.</p><p><strong>Prepared statement reuse.</strong> <code>sqlite3_prepare_v2()</code> compiles once. <code>sqlite3_step()</code> / <code>sqlite3_reset()</code> reuse the compiled code. The cost of SQL-to-bytecode compilation cancels out to near zero. The reimplementation recompiles on every call.</p><p><strong>Schema cookie check.</strong> uses one integer at a specific offset in the file header to read it and compare it. The reimplementation walks the entire <code>sqlite_master</code> B-tree and re-parses every CREATE TABLE statement after every autocommit.</p><p><code>fdatasync</code><strong> instead of </strong><code>fsync</code><strong>.</strong> Data-only sync wihtout metadata journaling saves measurable time per commit. The reimplementation uses <code>sync_all()</code> because it is the safe default.</p><p><strong>The </strong><code>iPKey</code><strong> check.</strong> One line in <code>where.c</code>. The reimplementation has <code>is_ipk: true</code> set correctly in its <code>ColumnInfo</code> struct but never checks it during query planning.</p><p>Competence is not writing 576,000 lines. A database persists (and processes) data. That is all it does. And it must do it reliably at scale. The difference between O(log n) and O(n) on the most common access pattern is not an optimization detail, it is the performance invariant that helps the system work at 10,000, 100,000 or even 1,000,000 or more rows instead of collapsing. Knowing that this invariant lives in one line of code, and knowing which line, is what competence means. It is knowing that <code>fdatasync</code> exists and that the safe default is not always the right default.</p><p></p><h2><strong>Measure What Matters</strong></h2><p>The <code>is_rowid_ref()</code> function is 4 lines of Rust. It checks three strings. But it misses the most important case: the named INTEGER PRIMARY KEY column that every SQLite tutorial uses and every application depends on.</p><p>That check exists in SQLite because someone, probably Richard Hipp 20 years ago, profiled a real workload, noticed that named primary key columns were not hitting the B-tree search path, and wrote one line in <code>where.c</code> to fix it. The line is not fancy. It doesn&#8217;t appear in any API documentation. But no LLM trained on documentation and Stack Overflow answers will magically know about it.</p><p>That&#8217;s the gap! Not between C and Rust (or any other language). Not between old and new. But between systems that were built by people who measured, and systems that were built by tools that pattern-match. LLMs produce plausible architecture. They do not produce all the critical details.</p><p>If you are using LLMs to write code (which in 2026 probably most of us are), the question is not whether the output compiles. It is whether you could find the bug yourself. Prompting with &#8220;find all bugs and fix them&#8221; won&#8217;t work. This is not a syntax error. It is a semantic bug: the wrong algorithm and the wrong syscall. If you prompted the code and cannot explain why it chose a full table scan over a B-tree search, you do not have a tool. The code is not yours until you understand it well enough to break it.</p><p>LLMs are useful. They make for a very productive flow when the person using them knows what correct looks like. An experienced database engineer using an LLM to scaffold a B-tree would have caught the <code>is_ipk</code> bug in code review because they know what a query plan <em>should</em> emit. An experienced ops engineer would never have accepted 82,000 lines instead of a cron job one-liner. The tool is at its best when the developer can define the acceptance criteria as specific, measurable conditions that help distinguish working from broken. Using the LLM to generate the solution in this case can be faster while also being correct. Without those criteria, you are not programming but merely generating tokens and hoping.</p><p>The vibes are not enough. Define what correct means. Then measure.</p><p></p><p>Stay safe out there!</p><h1><strong>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</strong></h1><p></p><div><hr></div><p><em>Current benchmark figures in this revision are from the 100-row run shown in </em><code>bench.png</code><em> (captured on a Linux x86_64 machine). SQLite 3.x (system libsqlite3) vs. the Rust reimplementation&#8217;s C API (release build, -O2). Line counts measured via <a href="https://github.com/boyter/scc">scc</a> (code only &#8212; excluding blanks and comments). All source code claims verified against the repository at time of writing.</em></p><div><hr></div><h2><strong>Sources</strong></h2><h3><strong>Primary Research</strong></h3><ul><li><p>Sharma, M. et al. <a href="https://arxiv.org/abs/2310.13548">&#8220;Towards Understanding Sycophancy in Language Models.&#8221;</a> ICLR 2024.</p></li><li><p>Shapira, Benade, Procaccia. <a href="https://arxiv.org/abs/2602.01002">&#8220;How RLHF Amplifies Sycophancy.&#8221;</a> arXiv, 2026.</p></li><li><p>BrokenMath: <a href="https://arxiv.org/abs/2510.04721">&#8220;A Benchmark for Sycophancy in Theorem Proving.&#8221;</a> NeurIPS 2025 Math-AI Workshop.</p></li><li><p>Mercury: <a href="https://arxiv.org/abs/2402.07844">&#8220;A Code Efficiency Benchmark.&#8221;</a> NeurIPS 2024.</p></li><li><p><a href="https://arxiv.org/abs/2503.06327">&#8220;Unveiling Inefficiencies in LLM-Generated Code.&#8221;</a> arXiv, 2025.</p></li><li><p>METR. <a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">&#8220;Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity.&#8221;</a> July 2025 (updated February 24, 2026).</p></li><li><p>GitClear. <a href="https://www.gitclear.com/ai_assistant_code_quality_2025_research">&#8220;AI Code Quality Research 2025.&#8221;</a> 2025.</p></li><li><p>Google. <a href="https://cloud.google.com/blog/products/devops-sre/announcing-the-2024-dora-report">&#8220;DORA Report 2024.&#8221;</a> 2024.</p></li></ul><h3><strong>Industry Commentary</strong></h3><ul><li><p>Osmani, A. <a href="https://addyosmani.com/blog/ai-coding-workflow/">&#8220;My LLM Coding Workflow Going Into 2026.&#8221;</a> addyosmani.com.</p></li><li><p>Willison, S. <a href="https://simonwillison.net/2025/Mar/11/using-llms-for-code/">&#8220;How I Use LLMs for Code.&#8221;</a> March 2025.</p></li><li><p>OpenAI. <a href="https://openai.com/index/sycophancy-in-gpt-4o/">&#8220;Sycophancy in GPT-4o: What Happened.&#8221;</a> April 2025.</p></li><li><p>Karpathy, A. <a href="https://x.com/karpathy/status/1886192184808149383">&#8220;Vibe Coding.&#8221;</a> February 2, 2025.</p></li></ul><h3><strong>Incidents</strong></h3><ul><li><p>Replit database deletion. <a href="https://www.theverge.com/ai/2025/7/10/replit-ai-deletes-database">The Verge</a>, July 2025.</p></li></ul><h3><strong>Rust Ecosystem</strong></h3><ul><li><p>Rust Foundation. <a href="https://blog.rust-lang.org/2025/02/13/2024-State-Of-Rust-Survey-results/">&#8220;2024 State of Rust Survey Results.&#8221;</a> February 2025.</p></li><li><p>ISRG / Thalheim, J. <a href="https://www.memorysafety.org/blog/reducing-dependencies-in-sudo/">&#8220;Reducing Dependencies in sudo-rs.&#8221;</a> memorysafety.org.</p></li></ul><h3><strong>Database Engineering</strong></h3><ul><li><p>SQLite Documentation: <a href="https://www.sqlite.org/rowidtable.html">rowidtable.html</a>, <a href="https://www.sqlite.org/queryplanner.html">queryplanner.html</a>, <a href="https://sqlite.org/cpu.html">cpu.html</a>, <a href="https://www.sqlite.org/testing.html">testing.html</a>, <a href="https://www.sqlite.org/mostdeployed.html">mostdeployed.html</a>, <a href="https://www.sqlite.org/malloc.html">malloc.html</a>, <a href="https://sqlite.org/cintro.html">cintro.html</a>, <a href="https://www.sqlite.org/c3ref/pcache_methods2.html">pcache_methods2</a>, <a href="https://sqlite.org/fileformat.html">fileformat.html</a>, <a href="https://sqlite.org/fileformat2.html">fileformat2.html</a></p></li><li><p>Callaghan, M. <a href="http://smalldatum.blogspot.com/2020/10/innodb-fsync-and-fdatasync-reducing.html">&#8220;InnoDB, fsync and fdatasync &#8212; Reducing Commit Latency.&#8221;</a> Small Datum, 2020.</p></li><li><p>Gunther, N. <a href="https://www.perfdynamics.com/Manifesto/USLscalability.html">&#8220;Universal Scalability Law.&#8221;</a> perfdynamics.com.</p></li><li><p>Fjall. <a href="https://fjall-rs.github.io/post/fjall-2-6-byteview/">&#8220;ByteView: Eliminating the .to_vec() Anti-Pattern.&#8221;</a> fjall-rs.github.io.</p></li><li><p><a href="https://github.com/spacejam/sled">sled</a> &#8212; embedded database with inline-or-Arc-backed IVec.</p></li><li><p><a href="https://github.com/cberner/redb">redb</a> &#8212; pure-Rust embedded database with user-space page cache.</p></li></ul><h3><strong>Books Referenced</strong></h3><ul><li><p>Skiena, S.S. <em><a href="https://www.amazon.com/Algorithm-Design-Manual-Computer-Science/dp/3030542556?crid=2ZUP4JANEYOFR&amp;sprefix=the+algorithm+design+manual%2Caps%2C186&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=85494361bfe8d87d86a57b283eff0873&amp;language=en_US&amp;ref_=as_li_ss_tl">The Algorithm Design Manual.</a></em> 3rd ed. Springer, 2020.</p></li><li><p>Winand, M. <em><a href="https://www.amazon.com/Performance-Explained-Everything-Developers-about/dp/3950307826?crid=2VNI4OOTWLX0T&amp;sprefix=sql+performance+explained%2Caps%2C190&amp;sr=8-1&amp;linkCode=ll2&amp;tag=katanalarp-20&amp;linkId=206fbed47a442c5c79d2a43e283967b0&amp;language=en_US&amp;ref_=as_li_ss_tl">SQL Performance Explained.</a></em> Self-published, 2012.</p></li><li><p>Hoare, C.A.R. <a href="https://dl.acm.org/doi/10.1145/358549.358561">&#8220;The Emperor&#8217;s Old Clothes.&#8221;</a> <em>Communications of the ACM</em> 24(2), 1981. (1980 Turing Award Lecture)</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Scraping Historical Orderbook Data [Bybit]]]></title><description><![CDATA[Table of Content]]></description><link>https://blog.katanaquant.com/p/scraping-historical-orderbook-data</link><guid isPermaLink="false">https://blog.katanaquant.com/p/scraping-historical-orderbook-data</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Thu, 25 Sep 2025 10:39:15 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kcEX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of Content</h1><ul><li><p>Intro</p></li><li><p>The Script</p></li><li><p>Downloadlink</p></li><li><p>Usage</p></li><li><p>DON&#8217;T STUFF YOUR DISK</p></li></ul><p></p><h1>Intro</h1><p>For my <a href="https://blog.katanaquant.com/t/f2p-trading-system">F2P Trading System Series</a> I was looking for a <strong>free</strong> way to get historical orderbook data for futures on Bybit. But I didn&#8217;t really find anything useful.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p><p><a href="https://bybit-exchange.github.io/docs/v5/market/orderbook">Unfortunately their API only responds with the current state of the order book</a>.</p><p></p><p>However, they offer a download option for this (and more) data over at <a href="https://www.bybit.com/derivatives/en/history-data">https://www.bybit.com/derivatives/en/history-data</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kcEX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kcEX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 424w, https://substackcdn.com/image/fetch/$s_!kcEX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 848w, https://substackcdn.com/image/fetch/$s_!kcEX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 1272w, https://substackcdn.com/image/fetch/$s_!kcEX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kcEX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png" width="920" height="636" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:636,&quot;width&quot;:920,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62215,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/174516925?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kcEX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 424w, https://substackcdn.com/image/fetch/$s_!kcEX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 848w, https://substackcdn.com/image/fetch/$s_!kcEX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 1272w, https://substackcdn.com/image/fetch/$s_!kcEX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2dab80a-ede7-4029-87fc-2f771ba8bcb6_920x636.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p> </p><p>Now I&#8217;m not the type of guy who manually uses form inputs and buttons a lot. The <em>daterange</em> you can choose from is also very limiting with only 7 calendar days in total. Though, you can reach back to 2023!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dMFH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dMFH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 424w, https://substackcdn.com/image/fetch/$s_!dMFH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 848w, https://substackcdn.com/image/fetch/$s_!dMFH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 1272w, https://substackcdn.com/image/fetch/$s_!dMFH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dMFH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png" width="1027" height="834" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:834,&quot;width&quot;:1027,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109298,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/174516925?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dMFH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 424w, https://substackcdn.com/image/fetch/$s_!dMFH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 848w, https://substackcdn.com/image/fetch/$s_!dMFH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 1272w, https://substackcdn.com/image/fetch/$s_!dMFH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9979b187-0f20-4552-be4e-048ca74ec943_1027x834.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h1>The Script</h1><p>That&#8217;s why I wrote this <a href="https://github.com/KatanaQuant/freebies/blob/main/ob_scraper/bybit_ob_scrape.py">little dirty scraper script</a> that downloads all the historical orderbook data for a given futures contract.</p><p>Simply put in the tickers name and it&#8217;ll start downloading.</p><p></p><p>It&#8217;s nothing fancy. It&#8217;s not super fast or anything but it gets the job done.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!d2lq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!d2lq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 424w, https://substackcdn.com/image/fetch/$s_!d2lq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 848w, https://substackcdn.com/image/fetch/$s_!d2lq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 1272w, https://substackcdn.com/image/fetch/$s_!d2lq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!d2lq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png" width="525" height="247" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:247,&quot;width&quot;:525,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35496,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/174516925?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!d2lq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 424w, https://substackcdn.com/image/fetch/$s_!d2lq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 848w, https://substackcdn.com/image/fetch/$s_!d2lq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 1272w, https://substackcdn.com/image/fetch/$s_!d2lq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7edc310b-d06a-47f3-a207-3240a8798e23_525x247.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h1>Downloadlink</h1><p><a href="https://github.com/KatanaQuant/freebies/tree/main/ob_scraper">You can find the script in this GitHub repository.</a></p><p></p><p><a href="https://github.com/KatanaQuant/freebies/tree/main/ob_scraper">https://github.com/KatanaQuant/freebies/tree/main/ob_scraper</a></p><p></p><h1>Usage</h1><p>Usage is also really simple.</p><p>You put in the symbol you want to fetch (defaults to BTCPERP),</p><p>the date of the earliest snapshot (defaults to 2023-01-01),</p><p>and the date of the latest snapshot (defaults to today())</p><pre><code>python bybit_ob_scrape.py \
  BTCPERP \
  --start-date 2023-01-01 \
  --end-date 2024-02-01 \

python bybit_ob_scrape.py \
  ETHPERP \
  --start-date=2023-01-18 \
  --end-date=2023-01-19

# also valid; fetches all the data due to defaults
python bybit_ob_scrape.py BTCPERP
</code></pre><p></p><p><strong>But beware:</strong></p><p></p><h1>DON&#8217;T STUFF YOUR DISK</h1><p>If you fetch all the historical orderbook data for BTCPERP, you&#8217;ll end up with ~63 GB of data. And it&#8217;ll only get worse from there. Unzipped it explodes to ~380 GB. Obviously this isn&#8217;t going to be a problem if you&#8217;re like me and have a lot of TB+ SSDs flying around.</p><p>However, I realize that not everyones device is equipped like this.</p><p></p><p><strong>So if you want to download and work with all the data available, further processing might be needed first!</strong></p><p></p><p>What I usually do is:</p><ul><li><p>download the raw data,</p></li><li><p>unpack it,</p></li><li><p>process it (ie pulling out the data I want to work with),</p></li><li><p>compress it,</p></li><li><p>persist the interesting parts for quick access and then</p></li><li><p>load off the raw data to a storage device or cloud for the future.</p></li></ul><p></p><p>That&#8217;ll be all for today.</p><p></p><p>Happy trading!</p><p></p><h1><strong>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</strong></h1><p><em>Disclaimer: The content and information provided by Vagabond Research, including all other materials, are for educational and informational purposes only and should not be considered financial advice or a recommendation to buy or sell any type of security or investment. Vagabond Research and its members are not currently regulated or authorised by the FCA, SEC, CFTC, or any other regulatory body to give investment advide. Always conduct your own research and consult with a licensed financial professional before making investment decisions. Trading and investing can involve significant risk, and you should understand these risks before making any financial decisions. Backtested and actual historic results are no guarantee of future performance. Use of the material presented is entirely at your own risk.</em></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[OpSec 101 - Part II]]></title><description><![CDATA[VPNs]]></description><link>https://blog.katanaquant.com/p/opsec-101-part-ii</link><guid isPermaLink="false">https://blog.katanaquant.com/p/opsec-101-part-ii</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Fri, 06 Jun 2025 11:48:50 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6bfcfd82-2a80-4cd1-a08c-eabedee6dd21_4960x4723.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1><strong>Table Of Contents</strong></h1><ul><li><p><strong>Recap</strong></p></li><li><p><strong>Disclaimer</strong></p></li><li><p><strong>VPNs Aren't About Security!</strong></p></li><li><p><strong>IP Address Threats</strong></p></li><li><p><strong>Geo-location Tracking</strong></p></li><li><p><strong>Browsing Behaviour</strong></p></li><li><p><strong>Fingerprinting</strong></p></li><li><p><strong>Download History</strong></p></li><li><p><strong>Data Breaches</strong></p></li><li><p><strong>VPN To The Rescue</strong></p></li><li><p><strong>Choosing A VPN Provider</strong></p></li><li><p><strong>Proton VPN</strong></p></li><li><p><strong>This Isn't The End</strong></p></li></ul><h1><strong>Recap</strong></h1><p>In the last <a href="https://blog.katanaquant.com/p/opsec-101-part-i">OpSec article</a> we talked about common threats, companies collecting "Telemetry" data, and what we can do to improve our privacy at the OS level by setting up Pop!_OS as our daily driver. Making our operating system more secure is a nice start, but there's still a lot more we can - and in my opinion should - do to limit our exposure. The next critical layer to tackle is network-level privacy.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;a6d43c3c-9bc7-4060-ad86-32da06f7b3a7&quot;,&quot;caption&quot;:&quot;Table Of Contents&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;OpSec 101 - Part I&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:288544939,&quot;name&quot;:&quot;H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;&quot;,&quot;bio&quot;:&quot;Systematic Retail Trader | No Financial Advice | OpSec | Webdev | Vagabond&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-02-09T07:01:07.470Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af1b7f9f-d1d4-4782-8a90-6554bde9ba36_6331x4099.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://blog.katanaquant.com/p/opsec-101-part-i&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:156658236,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vagabond Research&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><a href="https://x.com/levelsio/status/1923446906610761840">Recently, a discussion about VPN usage</a> sparked quite some debate, with developers and privacy enthusiasts debating their effectiveness and necessity. I'm not trying to "dunk" on this or anything. There are good arguments for both sides in it. Like most privacy tools, VPNs come with their own set of tradeoffs. There will always be pros and cons for using a VPN. Ultimately, your choice should depend on your personal threat model and privacy requirements.</p><p>Since the thread highlighted several misconceptions about VPN usage, I'd like to share my perspective to help you make an informed decision.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HswE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HswE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 424w, https://substackcdn.com/image/fetch/$s_!HswE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 848w, https://substackcdn.com/image/fetch/$s_!HswE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 1272w, https://substackcdn.com/image/fetch/$s_!HswE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HswE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png" width="933" height="675" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:675,&quot;width&quot;:933,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:128762,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/165256271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HswE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 424w, https://substackcdn.com/image/fetch/$s_!HswE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 848w, https://substackcdn.com/image/fetch/$s_!HswE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 1272w, https://substackcdn.com/image/fetch/$s_!HswE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a65d10f-d714-483a-acaa-adb1c809dfcd_933x675.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1><strong>Disclaimer</strong></h1><p>The information outlined during the writing of this may need to be modified in order to match updated software and services. Use the overall concepts as a guide. I encourage you to confirm all of my suggestions online before execution. There may be better ways of doing things today. Next, there is no perfect playbook for everyone. You do not need to replicate every step I take on behalf of myself. You may identify a better privacy plan for yourself than the specific examples presented here. And as always things written are not any type of advice. They are merely explicit examples of the actions I have taken. There will be a balance of enjoyable living and refusal to submit to the standard abuses of data collection. However, I won't sugar coat my opinions or offer less-secure options for the sake of convenience.</p><h1><strong>VPNs Aren't About Security!</strong></h1><p>As stated in the <a href="https://x.com/levelsio/status/1923446906610761840">levelsio thread</a>, VPNs don't offer (that much) security. There are some features that help enhance your networks overall security but the main purpose of using a VPN - at least for me - is to protect my data.</p><p>I've already talked about it <a href="https://blog.katanaquant.com/i/156658236/telemetry">in this article</a> but to quickly reiterate: Your internet service provider (ISP) and every website you visit or service you use collects data about you and your behaviour with the purpose of selling it. All of these companies are notoriously bad at protecting your data! Their databases get breached by hackers daily and your data ends up being publicly available on the internet. And it's not just hackers. Employees getting blackmailed, bribed or generally acting in bad faith are nothing new as the <a href="https://www.maine.gov/agviewer/content/ag/985235c7-cb95-4be2-8792-a1252b4f8318/f61fae18-f669-499e-9a87-f4d323d281f8.html">recent Coinbase scandal demonstrated</a>. Worse yet, companies often fail to notify users of breaches or actively lie to them about it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Z8n!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Z8n!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 424w, https://substackcdn.com/image/fetch/$s_!5Z8n!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 848w, https://substackcdn.com/image/fetch/$s_!5Z8n!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 1272w, https://substackcdn.com/image/fetch/$s_!5Z8n!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Z8n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png" width="771" height="1034" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1034,&quot;width&quot;:771,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:339993,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.katanaquant.com/i/165256271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!5Z8n!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 424w, https://substackcdn.com/image/fetch/$s_!5Z8n!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 848w, https://substackcdn.com/image/fetch/$s_!5Z8n!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 1272w, https://substackcdn.com/image/fetch/$s_!5Z8n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0940febf-5820-4ee9-8ade-06e67296f640_771x1034.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1><strong>IP Address Threats</strong></h1><p>This is especially concerning when it comes to your <strong>home IP address</strong>. This numeric value associates you and your internet browsing behavior to a unique identifier and can be used to document your location and track you through every website you visit. The more sites you visit, the worse it gets.</p><p>Some argue that there's no threat in sharing your IP address. <strong>I disagree!</strong> While it does not directly disclose your real-life home address (or geo-location in general), it has a number of threats associated with it:</p><h1><strong>Geo-location Tracking</strong></h1><p>First and foremost, it is relatively easy to pinpoint your physical location using just your IP address. Every website you visit gets your IP address. <strong>Every. Single. One.</strong> If just one of these countless services gets compromised or has a malicious employee, your location data is exposed.Law firms and other actors can simply request (or subpoena) this information. Even without considering legal methods, someone matching your identity to an IP address and then searching publicly available database dumps for more information about you, is a real threat!</p><p>To make things even worse, data brokers and advertising networks collect, aggregate, and sell IP-to-location mappings. Combined, this can create a detailed picture of your movements, locations and activities.</p><h1><strong>Browsing Behaviour</strong></h1><p>Your browsing history can be used against you in ways you might not expect.</p><p>It's true that HTTPS encryption protects the exact paths, query parameters and data sent of your web traffic. What this means is that your ISP can only see which domains you visited but nothing else. If you search for <em>VPN review</em> on google and end up on <em><a href="https://www.google.com/search?q=vpn+review">https://www.google.com/search?q=vpn+review</a></em>, your ISP only sees that you visited </p><p>https://www.google.com</p><p>, but they know when and how often you visit each site.</p><p>This creates a detailed history of your online activities which can be obtained via court orders, exposed through data breaches or accessed by malicious employees. Your digital footprint can become a powerful tool that can be used against you, may it be professionally or personally. With ISPs keeping detailed logs of sites you visit, that footprint is a lot bigger than you might think.</p><p>Even worse, not all websites properly implement SSL/TLS protocols. When you visit these sites, your ISP can capture everything - including passwords, form data, and messages. This vulnerability opens the door for man-in-the-middle attacks (MITM), which we'll discuss in more detail later.</p><p><strong>A very important note here:</strong> It's not only about your ISP. When connecting through public networks (caf&#233;s, airports, hotels), the one providing the connection can see the same things your ISP can! This creates a lot of ground for a broad range of MITM attacks.</p><h1><strong>Fingerprinting</strong></h1><p>Your IP address is just the tip of the iceberg when it comes to online tracking. Websites employ fingerprinting techniques that go far beyond simple IP address tracking.</p><p>When you visit a website, it can collect data about your:</p><ul><li><p>Browser type and version</p></li><li><p>Operating system and configuration</p></li><li><p>Screen resolution and color depth</p></li><li><p>Installed fonts and plugins</p></li><li><p>Language settings</p></li><li><p>Time zone</p></li><li><p>Hardware capabilities</p></li><li><p>etc.</p></li></ul><p><a href="https://x.com/levelsio/status/1923477776415256755">As highlighted in the discussion</a>, these data points create a unique "fingerprint" that can identify you across websites. When combined with your home IP address, this creates an even more serious privacy risk - your online activities can be permanently tied to your physical location, making your digital footprint virtually impossible to separate from your real-world identity.</p><h1><strong>Download History</strong></h1><p>Your download history presents another significant privacy risk, especially when tied to your home IP address. Law firms have built entire business models around tracking IP addresses associated with unauthorized downloads, sending threatening legal notices, and demanding settlement payments (read: extortion).</p><p>Is someone else besides you using your connection from time to time? Can you be absolutely sure everything they do is within legal bounds? If you expose your true IP address, it's very easy for these law firms to issue subpoenas and fine you.</p><h1><strong>Data Breaches</strong></h1><p>Data breaches have become a daily occurrence. Companies' databases are constantly being leaked online, exposing user information. When these breaches happen, they don't just reveal your personal information - they can completely unravel your entire privacy setup.</p><p>This becomes especially problematic if you maintain separate online identities:</p><ul><li><p>Creating anonymous accounts? They can be linked through your IP address.</p></li><li><p>Using different aliases? A data breach can connect them all.</p></li><li><p>Maintaining separate digital identities? Your home IP address becomes the common thread.</p></li></ul><p>Even with careful compartmentalization, using your true IP address creates a permanent link between all your online activities. When (not if) a service gets breached, that single point of failure can collapse years of careful privacy work like a house of cards.</p><p><strong>So if you believe any of this could remotely be a threat to you, you need to do something!</strong></p><h1><strong>VPN To The Rescue</strong></h1><p>So how can a VPN help with all these threats? Virtual Private Networks (VPNs) route your traffic through their servers and encrypt all data between your device and their network. This creates several key benefits:</p><ol><li><p><strong>Reduced Attack Surface</strong>: Instead of exposing your true IP address to every website you visit, only your VPN provider knows it. The websites visited only see the IP address of your VPN provider. This significantly reduces the risk of your real location being exposed through data breaches or malicious actors.</p></li><li><p><strong>Enhanced Privacy from ISPs</strong>: Your internet service provider can only see encrypted traffic to VPN servers - not which domains you visit or what you download. This prevents them from building detailed profiles of your browsing behavior.</p></li><li><p><strong>Protection on Public Networks</strong>: When using WiFi at caf&#233;s, hotels, or airports, your traffic remains encrypted and secure from potential man-in-the-middle attacks.</p></li><li><p><strong>Shared IP Addresses</strong>: Most VPN providers assign the same IP address to multiple users, making it much harder to track individual activity. Even if a website fingerprints this IP address, it can't be uniquely tied to you.</p></li></ol><p>Reputable VPN companies utilize "no logging" policies, which means they don't store any information about what sites you visited. This makes tracing your online activity much much harder.</p><p>However, it's crucial to understand that VPNs aren't an ultimate solution. While they help protect against IP address-based tracking, they won't prevent browser fingerprinting or other advanced tracking methods. This is why browser hardening and additional privacy tools are crucial parts of a comprehensive security setup (more on this later).</p><h1><strong>Choosing A VPN Provider</strong></h1><p>First of all: <strong>Ignore all VPN review sites</strong>. These are typically owned by VPN companies themselves, which explains why their top 10 lists look awfully similar.</p><p>Unfortunately, VPN providers are also notoriously bad at protecting your data. They often get caught selling it just like ISPs. They lie about having "no logging" policies when in reality they store data about your behaviour, making it possible to trace everything back to you.</p><p><strong>It's crucial to very carefully consider any of the following critical factors when choosing a VPN provider:</strong></p><ol><li><p><strong>Trust and Transparency:</strong> Look for providers that undergo regular third-party audits. Choose companies based in jurisdictions with strong privacy laws. I'd rather rely on a swiss company to protect my privacy than a russian or chinese one. Prefer independently owned companies over those under large corporate umbrellas. Big brands can just spin up new skins of their failed products and start new marketing campaigns when their users bail. Independently owned ones have a lot more to lose reputation wise.Verify their no-logging claims through audit reports</p></li></ol><ol start="2"><li><p><strong>Logging Policy:</strong> Understand that absolute zero logging is technically impossible. What matters is that any necessary logs are: a) only kept during your active connection, b) automatically purged after disconnection, c) not accessible in a way that could identify you</p></li></ol><ol start="3"><li><p><strong>Business Model:</strong> Avoid free VPN services - they often monetize through data collection. Look for clear revenue sources (i.e., subscription payments). Remember: <strong>If the service is free, you are likely the product</strong></p></li></ol><ol start="4"><li><p><strong>Technical Infrastructure:</strong> Prefer providers with large user bases sharing IP addresses to blend in with the crowd. This makes fingerprinting significantly harder.Look for open-source clients that can be audited by the community. Regular third party audits ensure that this open-source code and nothing else is being used to provide you service.Consider server ownership and control mechanisms</p></li></ol><ol start="5"><li><p><strong>Payment Privacy:</strong> Look for providers accepting anonymous payment methods. Consider cryptocurrency or cash payment options. Understand that you're not staying anonymous but simply protect your banking details here</p></li></ol><ol start="6"><li><p><strong>Self-Hosting Considerations:</strong> While offering more control, self-hosted VPNs have limitations. Single IP addresses makes you more identifiable. Self-hosting requires significant technical expertise since you become responsible for security.</p></li></ol><p><strong>Important Note:</strong> I believe that all VPNs are flawed. No provider is perfect. Every company relies on rented servers worldwide, potentially outside their direct control. However, this doesn't mean VPNs are useless - they're simply one layer in a broader privacy strategy. Without a VPN your ISP and any site you visit have a much easier time collecting and aggregating your data. I simply choose the provider that has the most to lose from betraying my trust and has a proven track record of protecting theirs users privacy.</p><p><strong>Yet another note:</strong> If your government or another sufficiently empowered actor with enough resources puts their scope on you, choosing the perfect jurisdiction or VPN provider won't save you. My biggest threat aren't governments though. For me it's all about data breaches and aggregation techniques of ISPs and websites.</p><h1><strong>Proton VPN</strong></h1><p>After careful consideration of all these factors, I personally use and recommend Proton VPN. Here's why:</p><p>They have a proven track record! There are no documented cases of user data exposure. They are open-source and regularly audited by a third-party, <a href="https://proton.me/blog/pass-open-source-security-audit">which they share publicly</a>.</p><p>Proton has a transparent no-logs policy, <a href="https://protonvpn.com/support/no-logs-vpn">see here about the details.</a>. Their no-logging policy <a href="https://protonvpn.com/blog/no-logs-audit/">also gets regularly audited.</a></p><p>As a swiss company, their privacy practices are based on one of the best privacy laws around the world. They typically only respond to swiss court orders.</p><p>Privacy-first payment options like BTC or anonymous cash via mail without personal information are supported.</p><p>I trust Proton VPN more than the majority of VPN companies out there.</p><p><a href="https://protonvpn.com/pricing">You can see their pricing here.</a> Their VPN Plus option is enough for most people.</p><p>I received no compensation for this article beyond potential referral commissions and I am not affiliated with Proton VPN at this point.</p><h1><strong>This Isn't The End</strong></h1><p>While setting up a VPN is a crucial step toward better privacy, it's just one piece of a much larger puzzle. In the upcoming OpSec articles, we'll explore how to build a comprehensive privacy setup that goes far beyond just using a VPN.</p><p>We'll have a look at a proper VPN configuration - from choosing consistent geo-locations over preventing account restrictions, to implementing kill-switches that prevent data leaks during disconnects. We'll discuss hardware 2FA implementation, dedicated IP adress considerations to mitigate VPN blocks by streaming services and such, and proper log management to ensure your VPN provides maximum protection without losing the ability to actually use your internet connection in a normal way.</p><p>Next, we'll tackle some more network-level protection. This includes setting up a custom hardware firewall that integrates with your VPN, implementing protection against VPN crashes and disconnects, while also establishing network-wide privacy for all your devices. We'll also dive into DNS blocking and filtering to further reduce tracking.</p><p>The browser, being your main interface to the internet, deserves special attention too. We'll cover recommended browsers, essential privacy-enhancing extensions, and techniques to protect against fingerprinting. You'll learn how to properly manage cookies, cache, and other potential privacy leaks.</p><p><strong>Remember: There is no single privacy tool that will magically protect you. Privacy is achieved through carefully selected tools, proper configuration, regular maintenance, and most importantly - mindful online behavior. Each solution comes with its own tradeoffs, and what works for one person might not work for another.</strong></p><p>Combined with our <a href="https://blog.katanaquant.com/p/opsec-101-part-i">previous guide on OS-level privacy</a>, you now have a solid foundation: a custom OS that respects your privacy and a VPN to protect your network traffic. But there's much more to come.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;c9f805c3-feee-48e2-91dc-6a7d6e8bbbb7&quot;,&quot;caption&quot;:&quot;Table Of Contents&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;OpSec 101 - Part I&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:288544939,&quot;name&quot;:&quot;H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;&quot;,&quot;bio&quot;:&quot;Systematic Retail Trader | No Financial Advice | OpSec | Webdev | Vagabond&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-02-09T07:01:07.470Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af1b7f9f-d1d4-4782-8a90-6554bde9ba36_6331x4099.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://blog.katanaquant.com/p/opsec-101-part-i&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:156658236,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vagabond Research&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p></p><p>So long, stay safe!</p><h1>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</h1><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[OpSec 101 - Part I]]></title><description><![CDATA[The Basics]]></description><link>https://blog.katanaquant.com/p/opsec-101-part-i</link><guid isPermaLink="false">https://blog.katanaquant.com/p/opsec-101-part-i</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Sun, 09 Feb 2025 07:01:07 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/af1b7f9f-d1d4-4782-8a90-6554bde9ba36_6331x4099.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table Of Contents</h1><ul><li><p><strong>Recap</strong></p></li><li><p><strong>What Is OpSec</strong></p></li><li><p><strong>100% Security Doesn't Exist</strong></p></li><li><p><strong>Common Threats</strong></p></li><li><p><strong>Doxing</strong></p></li><li><p><strong>Known Exploits</strong></p></li><li><p><strong>Zero Day Exploits</strong></p></li><li><p><strong>Social Engineering / Spam</strong></p></li><li><p><strong>How Are We Getting Hacked</strong></p></li><li><p><strong>Disclaimer</strong></p></li><li><p><strong>Telemetry</strong></p></li><li><p><strong>What We Can Do</strong></p></li><li><p><strong>Which Linux Version</strong></p></li><li><p><strong>Pop!_OS</strong></p></li><li><p><strong>Choosing The Device</strong></p></li><li><p><strong>Which Processor</strong></p></li><li><p><strong>Installing Pop!_OS</strong></p></li><li><p><strong>Configuring Pop!_OS</strong></p></li><li><p><strong>Your First Ride In The Terminal</strong></p></li><li><p><strong>Next Issue</strong></p></li></ul><h1>Recap</h1><p>Last week we've had a look at how to set a risk-target at the portfolio level and how to scale our position sizes to meet this target based on a continuous forecast created by an EMA8-32 crossover.</p><p>If you didn't yet, you can check out the article here</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;905cdd4e-5d9f-4e81-a029-95eeea660ac5&quot;,&quot;caption&quot;:&quot;Table Of Contents&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Translating Forecasts Into Position Sizes&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:288544939,&quot;name&quot;:&quot;H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;&quot;,&quot;bio&quot;:&quot;Systematic Retail Trader | No Financial Advice | OpSec | Webdev | Vagabond&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-02-02T07:30:54.320Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f77a5bd-1518-47cd-becd-0a1a6bf8689a_6000x3600.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://blog.katanaquant.com/p/translating-forecasts-into-position&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:156158673,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vagabond Research&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p></p><p>The plan was to follow this up with a backtest demonstration. However, something unexpected has come up, which requires most of my attention right now. That's why we're momentarily going to step away from the discussion and instead have a look at a substitute article about Operations Security 101, which has been in draft mode for some time now. This is a somewhat longer article so you might not be able to view it in full length within your mail application. <a href="https://open.substack.com/pub/katanaquant/p/opsec-101-part-i">Click here</a> to view it in your browser instead.</p><h1>What Is OpSec?</h1><p>Operations Security - short OpSec - can mean lots of different things depending on the context of the "operation" you're looking at. In a more general sense, OpSec describes the process of identifying whether your actions and information can be observed or obtained by external actors, which can use this information to exploit or hack your "operation".</p><p>But OpSec doesn't stop there! Identifying potential attack vectors is only one part of securing your business. The next, at least equally important part, is the selection and execution of measurements to mitigate the possibilities of getting exploited or leaking critical information in the first place.</p><p>Unfortunately, even though everybody knows about Maslow's Pyramid of Needs, having worked as Penetration Tester and CISO, I can confidently say that almost nobody takes this as serious as they should. This is especially sad since most actions you as an individual can take are pretty straightforward and offer high degrees of security.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!y2Q-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!y2Q-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 424w, https://substackcdn.com/image/fetch/$s_!y2Q-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 848w, https://substackcdn.com/image/fetch/$s_!y2Q-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 1272w, https://substackcdn.com/image/fetch/$s_!y2Q-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!y2Q-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin" width="1456" height="2060" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2060,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Maslows-Hierarchy-of-Needs-Educators-2204865472.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Maslows-Hierarchy-of-Needs-Educators-2204865472.png" title="Maslows-Hierarchy-of-Needs-Educators-2204865472.png" srcset="https://substackcdn.com/image/fetch/$s_!y2Q-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 424w, https://substackcdn.com/image/fetch/$s_!y2Q-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 848w, https://substackcdn.com/image/fetch/$s_!y2Q-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 1272w, https://substackcdn.com/image/fetch/$s_!y2Q-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbddf62b-7cbd-4962-b4d0-65188db1e24d_1587x2245.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>100% Security Doesn't Exist</h1><p>Technically anybody could get hacked at any point in time. There's no such thing as a 100% secure system. And depending on what threat you're up against, you really don't stand a chance. If <a href="https://en.wikipedia.org/wiki/Lazarus_Group">NKs Lazarazus group</a> somehow decides to target you with all their financial backing, knowledge and manpower, you mustn't slip up at any second to not get owned! Which is harder than one might think.</p><p>Luckily it makes zero sense for them to target you if you're not a high profile target with insane amounts of access, knowledge or funds. We're talking something like government level access or millions of dollars.</p><p>The threats you are facing are not even remotely comparable!</p><p>This doesn't mean you should ignore security entirely. Even though we can't get 100% security, we can come remarkably close by utilizing proper techniques and <strong>most important of all discipline</strong>.</p><h1>Common Threats</h1><p>To get a better idea of what <em>proper techniques</em> might look like, we can take a look at some of the most common attacks the average internet user might face:</p><h1>Doxing</h1><p>Doxing is commonly referred to the act of publishing sensitive details about a person online, including full name, home address, telephone numbers, family members, date of birth, social security number, employment details, etc. This information can then be used by others to spam your inboxes, steal your credentials or even visit you in real life.</p><h1>Known Exploits</h1><p>Known exploits are verified vulnerabilities which can be found in outdated software. For example if you open PDF files (like pirated ebooks) in a vulnerable Adobe application you could be unintentionally installing trojans that were embedded in them, setting up a backdoor for intruders.</p><p><strong>It is a must to ensure the software you use is always up to date!</strong></p><p>It's also a good idea to realize that nothing's ever really free. If someone is sharing pirated stuff with you, they might have other intentions than just gifting things to random strangers on the internet.</p><p><strong>Never download or open a document from any source which you do not fully trust!</strong> And even if you trust the source, it's better to have dedicated old burner laptop as your "warez" device and never connect it to the internet.</p><p>I have an old laptop which sole purpose is to launch some weird proprietary legacy 3rd party application, that's somehow a heads up sit n go poker video course. When I launch it, all kinds of trojan alerts go off. I verified like 90% of them to be false positives and chances are the rest of it are too. But keeping it on a non-primary offline device is about the best protection you can get without any additional effort. The device can only be accessed physically, not remotely by some trojan or virus.</p><h1>Zero Day Exploits</h1><p>Zero Day exploits are vulnerabilities that aren't widely known yet but are getting actively exploited in the wild by threat actors. There's not really much you can do about it other than staying disciplined during internet usage (more on that later) and praying that the softwares developers fix them ASAP.</p><h1>Social Engineering / Spam</h1><p>Often times, when someone got "hacked", they didn't really got "hacked". Makes sense? Probably not. Let me clarify that..</p><p>Consensus about getting hacked is some notion like: you, as the victim, didn't do anything but some attacker gained access to your system via lots of hard work sitting in a dark room, typing cryptic symbols into his laptop for hours on end.</p><p>More often than not, this is not the case though. Most people get "hacked" because they clicked some damn link in an email, installed some questionable program, ran a custom executable that got sent to them or plugged an unknown device into their computer, which then opened a backdoor in their system.</p><p>All of these come in basically two forms:</p><p>One of which is spam. Each and every existing mailaddress is getting bombarded with spam emails that promise either some riches or sexy dates, which you ought to claim by clicking on a link. Most mail providers do a pretty good job at filtering those out but some get through nontheless.</p><p>Another, more sophisticated version is when you're getting approached, either online or in real life, with some promising offer tailored towards you or your hobbies. Again, this can be some kind of enticing offer, that's especially enticing to you because it fits within your area of interest. It could also be some kind of blackmail attempt, claiming to have recorded you while watching porn or other things.</p><p>In almost all cases, it's best to just delete and ignore these entirely. Again, nobody really wants to give you something for free.</p><h1>How Are We Getting Hacked</h1><p>So what can we do to reduce the chances of getting exploited? To come up with ideas on how to harden our security, we can take some inspiration from what bad actors might be doing to attack us. Hacking a system doesn't work like hollywood makes it look like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oFXk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oFXk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 424w, https://substackcdn.com/image/fetch/$s_!oFXk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 848w, https://substackcdn.com/image/fetch/$s_!oFXk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 1272w, https://substackcdn.com/image/fetch/$s_!oFXk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oFXk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin" width="474" height="263" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:263,&quot;width&quot;:474,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;hacking_complete_2.jpeg&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="hacking_complete_2.jpeg" title="hacking_complete_2.jpeg" srcset="https://substackcdn.com/image/fetch/$s_!oFXk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 424w, https://substackcdn.com/image/fetch/$s_!oFXk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 848w, https://substackcdn.com/image/fetch/$s_!oFXk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 1272w, https://substackcdn.com/image/fetch/$s_!oFXk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8224b64d-05f3-4694-8ffe-00850e24304b_474x263.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It has a well defined process that starts with something called discovery or reconnaissance. During this stage hackers try to gather as much information as possible about the system they want to target. Now "system" can be a lot of things: your computer or any of your devices, you as a person, your online accounts, etc.</p><p>No matter the system, at this stage the attacker uses a mix of passive and active scanning and enumeration techniques. One of such techniques is called Open-source Intelligence, which describes the <em>"collection and analysis of data gathered from open sources to produce actionable intelligence." (Wikipedia)</em></p><p>The next step is a research stage in which attackers dig deeper and research any information they found on the system for known vulnerabilities or possible attack vectors. During the first cycle of an active engagement (aka hack), attackers usually look for low hanging fruits like known remote-code execution in outdated software, leaked passwords or easy ways to slip you malicious links. Anything that can establish a quick and easy tunnel into your system really.</p><p>After that comes the phase that everybody knows from films: the exploitation phase. Attackers start cracking hashes gathered via OSINT, attack your online accounts with credential stuffing, try to get you to click links or start actively exploiting running applications like websites you own, etc. If they don't succeed, they will circle back to stage 1 - Reconaissance - and do it all over again. Until they found a way in or lose interest.</p><p>After setting foot in your system, hackers start another reconaissance process but this time from the inside. Instead of passively scanning outside resources they are actively enumerating your whole network. Map out how your system is connected to other systems they then try to pivot into, escalating their privileges from "normal user" to administrator access where possible until they infiltrated the whole network.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Iood!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iood!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 424w, https://substackcdn.com/image/fetch/$s_!Iood!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 848w, https://substackcdn.com/image/fetch/$s_!Iood!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 1272w, https://substackcdn.com/image/fetch/$s_!Iood!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Iood!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin" width="1371" height="776" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:776,&quot;width&quot;:1371,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;pentesting_steps.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="pentesting_steps.png" title="pentesting_steps.png" srcset="https://substackcdn.com/image/fetch/$s_!Iood!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 424w, https://substackcdn.com/image/fetch/$s_!Iood!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 848w, https://substackcdn.com/image/fetch/$s_!Iood!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 1272w, https://substackcdn.com/image/fetch/$s_!Iood!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd8295b3d-6a00-48ad-820a-c949a0c901d4_1371x776.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>(Ignore the Reporting Tab in the graphic. This is only relevant for white-hats that are penetration testing systems to then report their findings to the systems owner. Not so much for malicious hackers)</em></p><h1>How Can We Protect Ourselves</h1><p>Unfortunately, we can't talk about how to mitigate all of this in this blogpost. There's so much to say that it probably won't even fit a normal-sized book.</p><p>What we can do however, is taking inspiration from this process and target low hanging fruits first to increase our security in a big way with small effort. And then gradually increase our protection as we go. In the future we're probably going to release an OpSec related article every other week or so.</p><p><strong>Security is a marathon, not a sprint!</strong> Every step taken helps. No matter how big of a step.</p><p>The remainder of this article will focus on the OSINT process, giving some rough guidelines on what we can do to protect critical information, and then presenting the most effective action you can take right now: changing your operating system to linux.</p><p>Establishing a secure and private computer is a priority before tackling any other task. It can become impossible to achieve security if someone is capturing your screen or sits in your network, intercepting traffic and communication. We need a clean and secure computer untouched by anyone!</p><h1>Disclaimer</h1><p><strong>The exact steps taken during the writing of this may need to be modified in order to match updated software and services. Use the overall methods as a guide and not the exact steps. I encourage you to confirm all of my suggestions online before execution. There may be better ways of doing things today. Next, there is no perfect playbook for everyone. You do not need to replicate every step I take on behalf of myself. You may identify a better privacy plan for yourself than the specific examples presented here. And as always things written are not any type of advice. They are merely explicit examples of the actions I have taken. There will be a balance of enjoyable living and refusal to submit to the standard abuses of data collection.</strong></p><h1>Telemetry</h1><p>So what can we do to deny attackers doing OSINT to gather information about us? To come up with a plan we first need to understand how information about us gets out into the internet in the first place.</p><p>Telemetry is a concept utilized by almost all companies, which defines the act of collecting, storing and processing sensitive data about you and your (computer) habits with the purpose of providing you a better experience, tailoring the system towards you.</p><p>While the intent might be true and not malicious, from my point of view it poses a huge privacy invasion. To make things worse, corporations are notoriously bad at securing information. Data breaches or leaks happen often, exposing this sensitive information to everyone on the internet.</p><p>Here's a somewhat more recent example of how even governments fail to accurately secure your data. You can't even withhold that information because it's the government, that's collecting it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B4Hj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B4Hj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 424w, https://substackcdn.com/image/fetch/$s_!B4Hj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 848w, https://substackcdn.com/image/fetch/$s_!B4Hj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 1272w, https://substackcdn.com/image/fetch/$s_!B4Hj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B4Hj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin" width="1356" height="438" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:438,&quot;width&quot;:1356,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;cnbc_social_security_breach.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="cnbc_social_security_breach.png" title="cnbc_social_security_breach.png" srcset="https://substackcdn.com/image/fetch/$s_!B4Hj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 424w, https://substackcdn.com/image/fetch/$s_!B4Hj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 848w, https://substackcdn.com/image/fetch/$s_!B4Hj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 1272w, https://substackcdn.com/image/fetch/$s_!B4Hj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda94b2d1-9076-4802-9011-dc8aa550b027_1356x438.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://www.cnbc.com/2024/08/15/billions-records-social-security-numbers-and-data-stolen-allegedly.html">Link to article</a></p><p>If you want to play around with this idea a little yourself, type your email address into </p><p><a href="https://haveibeenpwned.com/">https://haveibeenpwned.com/</a></p><p> to see which company also failed to protect your data.</p><p>But it doesn't even have to go this far. Data mining companies are collecting and scraping all sorts of personal information, matching it to your identity, your social network and your family and then package everything up to sell it as advertising profiles.</p><p>Here's an example of what Apple stores about their users, even if they try to stay anonymous by using an alias (and other privacy measures), you can easily confirm this yourself by requesting what Apple stores about you:</p><ul><li><p>Full alias name and email address provided during account creation</p></li><li><p>Alias physical address provided during account creation</p></li><li><p>The serial numbers for all devices</p></li><li><p>The dates you first used the email addresses with Apple</p></li><li><p>Multiple IP addresses possessed during use of the devices</p></li><li><p>The internal computer names assigned to all devices</p></li><li><p>The dates/times of any reformatting of the systems</p></li><li><p>The dates/times and IP address of last access to iTunes, FaceTime, and iCloud</p></li><li><p>Your time zones during usage of the devices</p></li><li><p>The telephone number provided during Apple account logins</p></li><li><p>Songs you listened to through the official Apple Music application</p></li><li><p>The moments within the songs when you paused the playback</p></li><li><p>Your IP addresses during media streaming from Apple's servers</p></li><li><p>Your preferred musical artists identified during their onboarding process</p></li><li><p>The serial number of your iPhones (or other phones)</p></li><li><p>All podcasts subscribed to through iOS devices</p></li><li><p>Titles of podcast episodes which had been completed or paused</p></li><li><p>Dates of podcast subscriptions and listening times</p></li><li><p>Podcasts which possessed reviews from you, including full review text</p></li><li><p>All app purchases, including free apps, downloaded to the device</p></li><li><p>All IP addresses assigned during downloads</p></li><li><p>All books downloaded through Apple Books</p></li><li><p>All IP addresses used during connections</p></li><li><p>An export of all entries from Apple Calendar</p></li><li><p>Documents and contacts remaining in iCloud</p></li><li><p>Auto-stored contacts from Apple Mail</p></li><li><p>Recipient email addresses accessed within Apple Mail</p></li><li><p>Dates and times of outgoing email</p></li><li><p>Real name extracted from outgoing email headers</p></li></ul><p></p><p>Or Some excerpt of what Microsoft likes to store:</p><ul><li><p>Typing diagnostic data from your keyboard</p></li><li><p>Microphone transmissions</p></li><li><p>Index of all media files on your computer</p></li><li><p>Webcam data</p></li><li><p>Browsing history</p></li><li><p>Search history</p></li><li><p>Location activity</p></li><li><p>Health activity collected by HealthVault, Microsoft Band, and other trackers</p></li><li><p>Privacy settings across the Microsoft application ecosystem This data would make it very easy to identify you, your location, and all online activity.</p></li></ul><p>In addition, if you have a microphone active and didn't disable the appropriate privacy settings, you could be sharing audio throughout the day. And this is only the hardware side of things. Imagine what information gets stored to create advertising profiles of you..</p><p>All of this data was monitored, collected and stored while the user assumed he was being anonymous.</p><p>Google or Amazon aren't any better!</p><p><strong>There simply is no anonymity with Closed Source!</strong></p><h1>What We Can Do</h1><p>There are multiple different approaches we can utilize to prevent the dangers of leaking sensitive information. They can be either REACTIVE or PROACTIVE. On the reactive side we can make an effort to remove publicly available information. This can become quite a challenge since notoriously everything that was once on the internet stays forever on the internet. It's still worth to do this regularly and we're going to show you how to do this and provide a template formular in a later issue.</p><p>On the PROACTIVE side we have things like spreading misinformation, preventing the collection of this data, not providing accurate details about ourselves or even completely relocate and start over assuming a new identity.</p><p>Preventing data leakage is a low hanging fruit because it can be done without lots of effort. Techniques include always using different email addresses for services, using different, secure passwords for each service, storing them locally encrypted in a password manager, using multi-factor authentication, using alias names instead of your real one where possible, using a VPN with integrated Ad, Tracker &amp; Malware protection, using DNS blocking services with blacklists for Ads, Tracking &amp; Malware hosts, using browser Add-Ons to block tracking, and much more.</p><p>This week we're going to show you how to set up your own Linux device so you can avoid getting scanned and objectified by big closed-source corporations like Apple and Microsoft.</p><h1>Why Linux</h1><p>Linux is the obvious answer to this problem because it doesn't do all of this nonsense out of the box. Technically, you could block all the telemetry of Apple and Microsoft but you need to actively maintain that protection after every little update. In a perfect world, you shouldn't really need to take such measures to prevent privacy invasions.</p><p>Linux has a lot of advantages:</p><ul><li><p>it doesn't require an online account</p></li><li><p>never ask for name, email, address, phone, credit card, etc.</p></li><li><p>doesn't collect telemetry (or if so can easily be disabled)</p></li><li><p>security is better because of attack surface. There are way more Windows users around the world so more time is spent on developing malware for windows</p></li><li><p>completely free and open source. Anyone can audit the code. Many active communities do so.</p></li><li><p>almost anything can be modified and customized as you like with full control</p></li><li><p>very lightweight. runs smoothly even on older devices</p></li><li><p>since any device possible, there's no vendor lock imposed on you like for MacBooks</p></li></ul><p>Almost any version of linux will be better privacy and security wise than MacOS and Windows.</p><h1>Which Linux Version</h1><p>Since linux is open-source there are quite a few versions out there to choose from. Anybody can spin up their own interpretation of how an operating system should look like.</p><p>If you've ever heard of QubesOS, it's basically a linux version that encapsulates your whole system with docker-like containerization. You can have different boxes for different tasks so your banking box doesn't know about your internet browsing container and vice versa. It might very well be the most private OS but has a very shallow learning curve due to its complexity.</p><p>Easier alternatives include distributions like Debian and Ubuntu and their subversions. For linux beginners the best choice is probably Ubuntu.</p><p>It allows easy access to software packages in a graphical interface and has some of the highest compatibility with existing computers. It also provides easy software update options, reflecting a large portion of Linux users with abundant online support. Ubuntu has way fewer driver issues than other systems when adding new hardware.</p><h1>Pop!_OS</h1><p>However, we're going to focus on Pop!_OS instead of Ubuntu. It is based on Ubuntu, but redesigned for privacy and security. The installer applies full-disk encryption by default. All telemetry is disabled and third-party connections are opt-in. The app store can install and update Flatpak/Deb programs. Snap is not installed. In addition Pop!_OS has better window tiling options and includes a recovery partition to easily restore your system when needed. Overall it just feels more polished.</p><p>Almost all steps in this installation guide can be used with Ubuntu, Mint or any other Debian distribution with minimal, if any, alterations.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!x6jW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!x6jW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 424w, https://substackcdn.com/image/fetch/$s_!x6jW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 848w, https://substackcdn.com/image/fetch/$s_!x6jW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 1272w, https://substackcdn.com/image/fetch/$s_!x6jW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!x6jW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin" width="474" height="266" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:266,&quot;width&quot;:474,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;pop_os.jpeg&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="pop_os.jpeg" title="pop_os.jpeg" srcset="https://substackcdn.com/image/fetch/$s_!x6jW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 424w, https://substackcdn.com/image/fetch/$s_!x6jW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 848w, https://substackcdn.com/image/fetch/$s_!x6jW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 1272w, https://substackcdn.com/image/fetch/$s_!x6jW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb30a984a-4403-478e-be13-8f3ce82fce3c_474x266.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>Choosing The Device</h1><p>If you're a macOS user, you're very limited to specific hardware approved and sold by Apple. If you want a laptop you only have a handful of options to choose from.</p><p>With linux - since it is so lightweight and can run on almost anything - the options are endless! You probably already possess an old laptop which is capable of running Pop!_OS. One of the best ways to test linux is to install it onto a retired or used machine. I keep old laptops specifically for testing new linux builds.</p><p>If you only have one computer, a linux virtual machine presents the ideal option for experimentation. However, this is not focus of todays article. We're going to set it up on a physical device in just a few moments.</p><p>A new computer is almost always my preference. Acquiring a new device as your security base mitigates any previous infections or issues your already existing devices might have fallen victim to. You might even be able to specify that you want linux installed on it when purchasing to spare some extra work and time.</p><p>I typically don't recommend desktops. Laptops are portable and include a screen, keyboard, and trackpad. If you need a desktop, you know your reasons why and do not need my input.</p><h1>Which Processor</h1><p>The only thing that's really important during device choice security wise might be the processor, which is the main chip that allows your computer to function. Virtually every Intel processor made since 2008 possesses the Intel Management Engine (IME). IME is a proprietary firmware embedded directly onto the chip. It is a small operating system which runs while your computer is running, asleep or even during standby.</p><p>AMD processors also have this option, which is called AMD Secure Technology (AMD ST). Their purpose is to allow your device being managed within a low-powered state. Network administrators take advantage of this to remotely control many aspects of the device within the network.</p><p>Now to be clear, this is different from the telemetry invasion! Concerns only arise due to the overall secretiveness around their closed-source code and several known vulnerabilities reported since 2017. You might never have a problem using an Intel ME enabled chip but you could - and I do - argue that any new zero day exploit for IME can be used by criminals.</p><p><strong>So if I ever would recommend a processor, it would be one with IME disabled!</strong></p><p>The most active vendor of linux based machines with IME disabled by default is <a href="https://system76.com/">System 76</a>. In addition they also use open-source firmwared called Coreboot which replaces the proprietary code included with most motherboards. Coreboot is typically faster and more secure than other BIOS version.</p><h1>Installing Pop!_OS</h1><p>Now that you've - hopefully - opted for an IME disabled and Coreboot device, we're ready to install Pop!_OS on it.</p><p>Step 1: Navigate to <a href="https://pop.system76.com/">https://pop.system76.com/</a> and click <strong>Download</strong>.<br>Step 2: Choose the <strong>Download 22.04 LTS</strong> option and allow the download.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VTkw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VTkw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 424w, https://substackcdn.com/image/fetch/$s_!VTkw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 848w, https://substackcdn.com/image/fetch/$s_!VTkw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 1272w, https://substackcdn.com/image/fetch/$s_!VTkw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VTkw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin" width="1448" height="671" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:671,&quot;width&quot;:1448,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;popos_dl.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="popos_dl.png" title="popos_dl.png" srcset="https://substackcdn.com/image/fetch/$s_!VTkw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 424w, https://substackcdn.com/image/fetch/$s_!VTkw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 848w, https://substackcdn.com/image/fetch/$s_!VTkw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 1272w, https://substackcdn.com/image/fetch/$s_!VTkw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52a95580-a55a-4bc2-aa51-ba1990495109_1448x671.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Step 3: Install Balena Etcher from <a href="https://etcher.balena.io/">https://etcher.balena.io/</a>, launch it and click <strong>Flash from file</strong> and select the downloaded iso file<br>Step 4: Click <strong>Select target</strong> and choose your USB drive.<br>Step 5: Click <strong>Flash</strong> and allow the process to complete.</p><p><strong>Note that this will completely erase any chosen USB drive, so be careful.</strong> As result you should have a bootable USB stick ready for Pop!_OS installation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bzwI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bzwI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 424w, https://substackcdn.com/image/fetch/$s_!bzwI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 848w, https://substackcdn.com/image/fetch/$s_!bzwI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 1272w, https://substackcdn.com/image/fetch/$s_!bzwI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bzwI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin" width="829" height="542" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:542,&quot;width&quot;:829,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;balena_etcher2.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="balena_etcher2.png" title="balena_etcher2.png" srcset="https://substackcdn.com/image/fetch/$s_!bzwI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 424w, https://substackcdn.com/image/fetch/$s_!bzwI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 848w, https://substackcdn.com/image/fetch/$s_!bzwI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 1272w, https://substackcdn.com/image/fetch/$s_!bzwI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6705d57c-6f1f-4ba5-949f-efff65ea83ba_829x542.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Step 6: Insert this drive into your computer and turn it on. Immediately press the key which presents boot options. This is typically, ESC, F1, F7, F8, F10, or DEL. Once you have your boot options screen loaded, select the USB drive with your Pop!_OS installation.</p><p>Step 7: Click <strong>Try or Install Pop!_OS</strong>, select language, location, keyboard layout. Choose <strong>clean install</strong> and select your internal drive, then click <strong>Erase and Install</strong>. Provide your desired computer name and password. Select the default option to encrypt the drive. To increase security, choose a different password for the encryption than you chose for your user.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8B-v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8B-v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!8B-v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!8B-v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!8B-v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8B-v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin" width="1274" height="793" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:793,&quot;width&quot;:1274,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;popos_installer.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="popos_installer.png" title="popos_installer.png" srcset="https://substackcdn.com/image/fetch/$s_!8B-v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!8B-v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!8B-v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!8B-v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3233f4a-4554-42d0-a9fd-78b180dc0951_1274x793.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Step 8: Allow the process to complete and click <strong>Restart Device</strong>. When the computer rebooted, enter your password to unlock the encrypted disk. Next enter your users password to access your Pop!_OS installation.</p><p>After gaining access, you're going to be presented a one-time setup. Choose whatever settings you like. <strong>Keep location services disabled!</strong> Click <strong>Skip</strong> to bypass any online accounts and <strong>Start Using Pop!_OS.</strong></p><h1>Configuring Pop!_OS</h1><p>While Pop!_OS is already more secure than Ubuntu by default I still like to take it a step further. These are configurations I commonly use during the setup of my new devices:</p><p>Step 1: Launch settings in the lower-right of the dock, toggle <strong>Bluetooth</strong> to off.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RsWC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RsWC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!RsWC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!RsWC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!RsWC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RsWC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin" width="1274" height="793" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:793,&quot;width&quot;:1274,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;popos_settings.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="popos_settings.png" title="popos_settings.png" srcset="https://substackcdn.com/image/fetch/$s_!RsWC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!RsWC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!RsWC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!RsWC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60f7840c-2a85-4ef4-bcdd-e484924eb883_1274x793.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Step 2: Click <strong>Privacy</strong> in the left menu and disable <strong>Connectivity Checking</strong><br>Step 3: Click <strong>File History &amp; Trash</strong> and disable everything.<br>Step 4: Click <strong>Screen</strong> and change <strong>Blank Screen Delay</strong> to a longer period<br>Step 5: Go back to main screen, click <strong>Power</strong> and disable <strong>Automatic Screen Brightness</strong> and <strong>Dim Screen</strong><br>Step 6: Click <strong>Automatic Suspend</strong> and disable all options.<br>Step 7: Enable <strong>Show Battery Percentage</strong></p><h1>Your First Ride In The Terminal</h1><p>We're almost done. Just a few more things we need to take care of, this time using the terminal. The linux terminal is a text-based interface which allows you to interact with linux by entering commands. You can use it to execute tasks and navigate the file system and running programs.</p><p>Open a terminal by opening the black icon in the Dock (or use the Windows key and type in terminal).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5-TO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5-TO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!5-TO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!5-TO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!5-TO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5-TO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin" width="1274" height="793" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:793,&quot;width&quot;:1274,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;popos_terminal.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="popos_terminal.png" title="popos_terminal.png" srcset="https://substackcdn.com/image/fetch/$s_!5-TO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!5-TO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!5-TO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!5-TO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F67221af6-980c-4075-8e53-068c8ed4b589_1274x793.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Update your system: copy paste <code>sudo apt update &amp;&amp; sudo apt upgrade -y &amp;&amp; sudo flatpak update -y &amp;&amp; sudo apt full-upgrade -y &amp;&amp; sudo pop-upgrade release upgrade</code> into your terminal and hit enter.</p><p>This step might take a few minutes. Yeah, that's right.. minutes! Updating a linux distribution will never look like its Windows counterpart where you have to stare at a blue screen for hours on end and cycle through 20 reboots. There's virtually zero downtime when updating a linux machine. <strong>That's why you should run this command daily to always stay up to date.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IGBp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IGBp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!IGBp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!IGBp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!IGBp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IGBp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin" width="1274" height="793" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:793,&quot;width&quot;:1274,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;popos_cp_update.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="popos_cp_update.png" title="popos_cp_update.png" srcset="https://substackcdn.com/image/fetch/$s_!IGBp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 424w, https://substackcdn.com/image/fetch/$s_!IGBp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 848w, https://substackcdn.com/image/fetch/$s_!IGBp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 1272w, https://substackcdn.com/image/fetch/$s_!IGBp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39b58517-e604-4e43-a956-2a0d53578285_1274x793.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Remove the unnecessary Ubuntu Pro warnings: copy paste <code>mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf.bak</code> into your terminal.</p><p>Install antivirus: copy paste <code>sudo apt install -y clamav clamav-daemon</code> into your terminal and hit enter. More on this in a later issue. This step is good enough to get basic protection for now.</p><p>Remove your background: copy paste the following 3 commands and hit enter after each one:<br><code>gsettings set org.gnome.desktop.background picture-uri ''</code>,<br><code>gsettings set org.gnome.desktop.background picture-uri-dark ''</code>,<br><code>gsettings set org.gnome.desktop.background primary-color 'rgb(66, 81, 100)'</code>.</p><p>You can change the rgb numbers to create the perfect color for your desktop. <a href="https://www.w3schools.com/colors/colors_rgb.asp">https://www.w3schools.com/colors/colors_rgb.asp</a> should help.</p><p>Add the option to <strong>delete permanently</strong> to your explorers context menu (rightclick) instead of moving things to trash: <code>gsettings set org.gnome.nautilus.preferences show-delete-permanently true</code></p><h1>Next Issue</h1><p>Congratulations! You now possess a privacy and security hardened linux device!</p><p>This was only the first step though. We're going to use that as a base to build up our stack over time. Right now we only prevented the collecting of sensitive data by Microsoft and Apple.</p><p>Next we're going to have a look at how to prevent privacy invasion based on Ads and Trackers. For this we're going to use a custom NextDNS profile and a VPN to block invasive connections at the network level so they don't even hit our device.</p><p>On top of that we're going to choose and configure Firefox as our main browser to block even more trackers and then talk about some proper ways to navigate and use the modern internet to stay safe and how to remove publicly available information about ourselves.</p><p>So long, stay safe!</p><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[A Dockerized Crypto Data Hub - Part II]]></title><description><![CDATA[Why You Should Index Your Database]]></description><link>https://blog.katanaquant.com/p/a-dockerized-crypto-data-hub-part-cfa</link><guid isPermaLink="false">https://blog.katanaquant.com/p/a-dockerized-crypto-data-hub-part-cfa</guid><dc:creator><![CDATA[Hōrōshi バガボンド]]></dc:creator><pubDate>Sun, 12 Jan 2025 07:01:56 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!GIxI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Table of Contents</h1><ul><li><p><strong>Recap</strong></p></li><li><p><strong>Why An Index Is Important</strong></p></li><li><p><strong>The Most Common Index: B-tree</strong></p></li><li><p><strong>Index Leaf Nnodes</strong></p></li><li><p><strong>The B-tree</strong></p></li><li><p><strong>Installing dbeaver &amp; connecting to your db</strong></p></li><li><p><strong>Searching without index</strong></p></li><li><p><strong>The EXPLAIN statement</strong></p></li><li><p><strong>Creating the index</strong></p></li><li><p><strong>Searching with index</strong></p></li><li><p><strong>Joining without index</strong></p></li><li><p><strong>The gist of it</strong></p></li></ul><h1>Recap</h1><p><a href="https://katanaquant.com/blog/a-dockerized-crypto-data-hub">Last issue we utilized Docker and docker-compose</a> to create a research data base and then seeded it with free historical EOD price data for 10k crypto tokens.</p><p>If you didn't already, you can check out the article here.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;4a9e72d7-a252-406a-80ea-a0d40c0db3e1&quot;,&quot;caption&quot;:&quot;Recap After talking about statistical models like Geometric Brownian Motion and Ornstein-Uhlenbeck to create realistic synthetic price series for backtesting, we're almost done with the data-part for our research lab.&quot;,&quot;cta&quot;:null,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;lg&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;A Dockerized Crypto Data Hub - Part I&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:288544939,&quot;name&quot;:&quot;H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;&quot;,&quot;bio&quot;:&quot;Systematic Trader | Retail | Vagabond | No Financial Advice&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2024-12-15T07:00:46.962Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb4f5b62-0225-4b33-932f-039891b0b793_1536x898.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://blog.katanaquant.com/p/a-dockerized-crypto-data-hub-part&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:152963095,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:null,&quot;publication_name&quot;:&quot;Vagabond Research&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05228c58-1281-4c31-b75d-3d00e1022b83_7200x5952.jpeg&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>This week we're going to take a look at working with databases as a developer, specifically how to create and use an index.</p><h1>Why An Index Is Important</h1><p>If you already did some work with databases you probably have heard something along the lines of <em>"SQL is inherently slow"</em>. While this might have been true in the past, it's definitely not true anymore. Still, developers often face performance issues when working with SQL databases.</p><p>Why does this happen?</p><p>SQL is a programming language that separates <strong>what</strong> data is needed from <strong>how</strong> to get it. Let's take a look at a very simple example of fetching all the exchanges you can trade BTC on from our database.</p><pre><code>SELECT exchanges FROM coins WHERE symbol = 'BTC'</code></pre><p>The above SQL query only specifies <strong>what</strong> data you're interested in: the value of the column named <em>exchanges</em> which is stored in BTCs row in the table <em>coins</em>. We search for the table by matching its column named <em>symbol</em>. What the query doesn't specify is <strong>how</strong> the database should retrieve this information!</p><p>On the one hand this abstraction is good for developers because we don't have to think all that much about <strong>how</strong> to pull the data from our data store. We just need to tell it <strong>what</strong> data we want.</p><p>The query planner of the database will itself decide how to access that data by simulating different access techniques, scoring them and then executing the best performing one. If we dont set up our database in a way we can pull data efficiently, the only thing the optimizer can really do is going through all rows sequentially, one by one, until it finds what we need.</p><p>Right now we "only" have about 8 million rows of historical EOD spot crypto price data including volume and market cap. "Only" in hyphens because even though 8 million rows are basically nothing for a modern database, you will see that how exactly we're searching and accessing its data already makes quite the difference. Things will only get worse over time as we gradually add more data - new EOD crypto prices, other timeframes, different asset classes to diversify better, etc.</p><p>Since we're building this datahub for research, we want to be able to fetch data from it (and also execute all other steps) as fast as possible so we can iterate quickly.</p><p>This is where an index comes in! It works just like a phonebook. You only have to skim a few pages instead of the whole book for the data you're looking for after specifying an entry point like the first letter of someones lastname.</p><p>Let's take a closer look at how an index works.</p><h1>The Most Common Index: B-tree</h1><p>The B-tree (not binary tree!) is the most common SQL index and also happens to be the default in most databases to quickly access data. It supports equality and range querying and also works with sorting.</p><p>Since it's the default index in PostgreSQL we can create a B-tree index using</p><pre><code>CREATE INDEX idx_coins_symbol on coins(symbol);</code></pre><p>The query planner will consider using the B-tree index whenever an indexed column is used for a comparison or any of these operators: <code>BETWEEN, IN, IS NULL, IS NOT NULL</code> and pattern matching anchored to the beginning <code>col LIKE 'foo%' </code>but not <code>col LIKE '%bar'</code>.</p><p>Creating an index doesn't change the tables data. It creates a new data structure that acts as a pointer and refers to the table.</p><p>Searching in a database index is like searching an ordered phonebook. Finding data in an ordered data set is faster because the sort order determines each entrys position.</p><h1>Index Leaf Nodes</h1><p>One of the drawbacks of using an index is that changing data via <code>INSERT</code>, <code>DELETE</code>, <code>UPDATE</code> becomes slower because it needs to update the index order immediately to prevent moving large amounts of data.</p><p>For this reason the database combines two different data structures to make accessing data faster while also keeping write operations sane: <a href="https://www.geeksforgeeks.org/doubly-linked-list/">a doubly linked list</a> and a search tree (the B-tree).</p><p>If you think of the B-tree as a literal tree, the doubly linked lists are the leafs hanging from its branches. They serve the purpose of establishing a logical order independent from the physical order in memory. The leafs keep a reference of their physical location, matching it to their logical order within this list.</p><p>Each entry knows about the previous and next logical entry. If we would only keep track of the physical order, each write operation would need to move large amounts of data to keep the phyiscal order updated, which is very time consuming.</p><p>By inserting new leaf nodes between two existing nodes, updating their logical links, we don't need to touch the physical order at all. We just need to move some pointers.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GIxI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GIxI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 424w, https://substackcdn.com/image/fetch/$s_!GIxI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 848w, https://substackcdn.com/image/fetch/$s_!GIxI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 1272w, https://substackcdn.com/image/fetch/$s_!GIxI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GIxI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png" width="934" height="678" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:678,&quot;width&quot;:934,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:91498,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GIxI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 424w, https://substackcdn.com/image/fetch/$s_!GIxI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 848w, https://substackcdn.com/image/fetch/$s_!GIxI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 1272w, https://substackcdn.com/image/fetch/$s_!GIxI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb39920b-637d-46e1-a4b6-83f826f3b6b4_934x678.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>The B-tree</h1><p>Since the leaf nodes are stored in an arbitrary order - like shuffling the pages of your phonebook - databases put a second structure on top to quickly find the entries again: a balanced search tree with <em>root</em> and <em>branch nodes</em>.</p><p>A <em>branch layer</em> is built up until all the <em>leaf nodes</em> are covered where each branch node stores the biggest values of their respective leaf nodes. On top of that is another layer, that stores the biggest values of their underlying branch nodes. This repeats until all biggest values fit into a single node, the <em>root node</em>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Sodm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Sodm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 424w, https://substackcdn.com/image/fetch/$s_!Sodm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 848w, https://substackcdn.com/image/fetch/$s_!Sodm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 1272w, https://substackcdn.com/image/fetch/$s_!Sodm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Sodm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png" width="1110" height="697" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:697,&quot;width&quot;:1110,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:190660,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Sodm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 424w, https://substackcdn.com/image/fetch/$s_!Sodm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 848w, https://substackcdn.com/image/fetch/$s_!Sodm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 1272w, https://substackcdn.com/image/fetch/$s_!Sodm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06649ded-a9ac-4669-89ad-0a16ee78cc81_1110x697.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If we search for the key 57, we traverse the tree in ascending order until a value is greater than or equal to 57. Since the tree is balanced - which just means the distance between each root and leaf node is the same everywhere - this search works almost instantly even on huge data sets.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mUc1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mUc1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 424w, https://substackcdn.com/image/fetch/$s_!mUc1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 848w, https://substackcdn.com/image/fetch/$s_!mUc1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 1272w, https://substackcdn.com/image/fetch/$s_!mUc1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mUc1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png" width="914" height="432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:432,&quot;width&quot;:914,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:43083,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mUc1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 424w, https://substackcdn.com/image/fetch/$s_!mUc1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 848w, https://substackcdn.com/image/fetch/$s_!mUc1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 1272w, https://substackcdn.com/image/fetch/$s_!mUc1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983d0e0c-262c-40cb-93e0-cc4310dc7e21_914x432.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let's see it in action.</p><h1>Installing dbeaver &amp; connecting to our db</h1><p>We're going to use <a href="https://dbeaver.io/">dbeaver</a> to fiddle around with our database for now. Ultimately we should've created the index in our <strong>init.sql</strong> file while seeding it. After we're done with taking a closer look at our index in action, we're going to add it to the file so it will get created automatically when we redeploy our datahub utilizing docker.</p><p>After installing dbeaver, we need to create a new connection for our database, specifically a PostgreSQL connection (elephant).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nW-J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nW-J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 424w, https://substackcdn.com/image/fetch/$s_!nW-J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 848w, https://substackcdn.com/image/fetch/$s_!nW-J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 1272w, https://substackcdn.com/image/fetch/$s_!nW-J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nW-J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin" width="977" height="726" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:726,&quot;width&quot;:977,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;dbeaver_new_con.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="dbeaver_new_con.png" title="dbeaver_new_con.png" srcset="https://substackcdn.com/image/fetch/$s_!nW-J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 424w, https://substackcdn.com/image/fetch/$s_!nW-J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 848w, https://substackcdn.com/image/fetch/$s_!nW-J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 1272w, https://substackcdn.com/image/fetch/$s_!nW-J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3ecb381-1749-4125-b86d-9fc1383ee7a3_977x726.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Select the elephant and click <strong>Next</strong>. If you're prompted to download the PostgreSQL driver, select <strong>Yes</strong> and continue. In the next menu you need to fill out some details for the connection. Fill the missing fields with the contents of your <strong>.env</strong> file so it matches our example and hit <strong>OK</strong>.</p><pre><code>DB_USER=postgres
DB_PW=password
DB_DB=postgres
DB_PORT=5432</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!03sw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!03sw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 424w, https://substackcdn.com/image/fetch/$s_!03sw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 848w, https://substackcdn.com/image/fetch/$s_!03sw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 1272w, https://substackcdn.com/image/fetch/$s_!03sw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!03sw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin" width="1244" height="873" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:873,&quot;width&quot;:1244,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;dbeaver_con_conf.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="dbeaver_con_conf.png" title="dbeaver_con_conf.png" srcset="https://substackcdn.com/image/fetch/$s_!03sw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 424w, https://substackcdn.com/image/fetch/$s_!03sw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 848w, https://substackcdn.com/image/fetch/$s_!03sw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 1272w, https://substackcdn.com/image/fetch/$s_!03sw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F89ba3627-86b8-400e-b56b-250012a53be6_1244x873.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You should now be able to connect to the database with dbeaver after starting the datahub with <code>docker-compose up</code>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9ZUi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9ZUi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 424w, https://substackcdn.com/image/fetch/$s_!9ZUi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 848w, https://substackcdn.com/image/fetch/$s_!9ZUi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 1272w, https://substackcdn.com/image/fetch/$s_!9ZUi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9ZUi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin" width="1456" height="658" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:658,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;dveaver_inspect.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="dveaver_inspect.png" title="dveaver_inspect.png" srcset="https://substackcdn.com/image/fetch/$s_!9ZUi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 424w, https://substackcdn.com/image/fetch/$s_!9ZUi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 848w, https://substackcdn.com/image/fetch/$s_!9ZUi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 1272w, https://substackcdn.com/image/fetch/$s_!9ZUi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb17d33b8-7505-4810-ac05-85a2655fdd05_2244x1014.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>Searching Without Index</h1><p>Let's pull down the information for a randomly selected coin: LOKA. To do this we need to make use of the <code>WHERE</code> clause. Navigate to the <strong>coins table</strong> by clicking through the connection: <strong>postgres</strong> -&gt; <strong>Databases</strong> -&gt; <strong>postgres</strong> -&gt; <strong>Schemas</strong> -&gt; <strong>public</strong> -&gt; <strong>Tables</strong> -&gt; <strong>coins</strong>.</p><p><strong>CTRL + Click</strong> into the green tablename top left to open the SQL editor</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!y72v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!y72v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 424w, https://substackcdn.com/image/fetch/$s_!y72v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 848w, https://substackcdn.com/image/fetch/$s_!y72v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 1272w, https://substackcdn.com/image/fetch/$s_!y72v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!y72v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin" width="824" height="201" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:201,&quot;width&quot;:824,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;dbeaver_ctrl_click_sql_editor.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="dbeaver_ctrl_click_sql_editor.png" title="dbeaver_ctrl_click_sql_editor.png" srcset="https://substackcdn.com/image/fetch/$s_!y72v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 424w, https://substackcdn.com/image/fetch/$s_!y72v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 848w, https://substackcdn.com/image/fetch/$s_!y72v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 1272w, https://substackcdn.com/image/fetch/$s_!y72v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02de9df5-bb0d-4ac1-9c68-9d48b6c07234_824x201.bin 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>and copy-paste the following SQL query in there before hitting the green play button.</p><pre><code>SELECT * FROM coins where symbol ='LOKA';</code></pre><p>Sure enough we get some data:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!f3-q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f3-q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 424w, https://substackcdn.com/image/fetch/$s_!f3-q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 848w, https://substackcdn.com/image/fetch/$s_!f3-q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 1272w, https://substackcdn.com/image/fetch/$s_!f3-q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f3-q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin" width="1456" height="941" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:941,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;where_symbol_loka.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="where_symbol_loka.png" title="where_symbol_loka.png" srcset="https://substackcdn.com/image/fetch/$s_!f3-q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 424w, https://substackcdn.com/image/fetch/$s_!f3-q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 848w, https://substackcdn.com/image/fetch/$s_!f3-q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 1272w, https://substackcdn.com/image/fetch/$s_!f3-q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48932e14-3524-460e-a3f8-4c75c4375dba_2248x1453.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>The EXPLAIN Statement</h1><p>Before the database executes any SQL query, its optimizer creates an execution plan for it. Its exact inner workings are not so important right now. It does so by calculating fictive <strong>cost</strong> amounts for different types of scans for the task at hand, and then comparing them to find the cheapest one.</p><p>PostgreSQL (&gt;=9.2) has 4 types of index access mechanics:</p><ul><li><p><code>The SEQ SCAN</code>: Scans the entire table as it is stored on the disk step by step until it finds the correct entry.</p></li><li><p><code>The INDEX SCAN</code>: Performs a B-tree traversal, walking through the leaf nodes to find all matching entries, and fetching the data.</p></li><li><p><code>The INDEX ONLY SCAN</code>: Also performs a B-tree traversal but skips accessing the table because it can find selected columns in the index itself.</p></li><li><p><code>The BITMAP INDEX / HEAP SCAN</code>: Works like an <code>INDEX SCAN</code> but instead of fetching only one tuple-pointer fetches all tuple-pointers, sorts them via in-memory bitmap, and then visits the table tuples in physical order.</p></li></ul><p>If there is no index present, the optimizer often has no choice but using a <code>SEQ SCAN</code> and scan the entire table to find the location of the requested data. If possible, we want to never use a <code>SEQ SCAN</code>.</p><p>To see which scan is being used for our SQL query, we can just ask the database by putting an <code>EXPLAIN</code> statement in front:</p><pre><code>EXPLAIN SELECT * FROM coins where symbol ='LOKA';</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xYBR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xYBR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 424w, https://substackcdn.com/image/fetch/$s_!xYBR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 848w, https://substackcdn.com/image/fetch/$s_!xYBR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 1272w, https://substackcdn.com/image/fetch/$s_!xYBR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xYBR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin" width="1203" height="460" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:460,&quot;width&quot;:1203,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;explain_loka_where.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="explain_loka_where.png" title="explain_loka_where.png" srcset="https://substackcdn.com/image/fetch/$s_!xYBR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 424w, https://substackcdn.com/image/fetch/$s_!xYBR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 848w, https://substackcdn.com/image/fetch/$s_!xYBR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 1272w, https://substackcdn.com/image/fetch/$s_!xYBR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F614efffe-18c8-4db4-a4ab-a67b34d1e879_1203x460.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As you can see, we're utilizing a <code>SEQ SCAN</code> to access our data. This is because we don't have an index on the column we're searching in yet.</p><p>We can also add the <code>ANALYZE</code> keyword to take an even deeper look into the execution plan:</p><p><strong>DISCLAIMER:</strong> The <code>ANALYZE</code> option executes the statement to record actual timing and row counts! This is mostly harmless for <code>SELECT</code> statements but it modifies your data when using it for <code>INSERT</code>, <code>UPDATE</code> or <code>DELETE</code> operations. To avoid the risk of accidentally modifying your data, you should enclose it in a transaction and perform a rollback afterwards.</p><pre><code>EXPLAIN ANALYZE SELECT * FROM coins where symbol ='LOKA';</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mUCg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mUCg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 424w, https://substackcdn.com/image/fetch/$s_!mUCg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 848w, https://substackcdn.com/image/fetch/$s_!mUCg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 1272w, https://substackcdn.com/image/fetch/$s_!mUCg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mUCg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin" width="1203" height="460" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:460,&quot;width&quot;:1203,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;explain_analyze.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="explain_analyze.png" title="explain_analyze.png" srcset="https://substackcdn.com/image/fetch/$s_!mUCg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 424w, https://substackcdn.com/image/fetch/$s_!mUCg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 848w, https://substackcdn.com/image/fetch/$s_!mUCg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 1272w, https://substackcdn.com/image/fetch/$s_!mUCg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F36a64da5-ed6c-4f25-ae8f-9b432c2b40ef_1203x460.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We're scanning exactly 10,412 table rows in 0.847 ms to find LOKAs row. Is this bad? Well.. let's find out</p><h1>Creating The Index</h1><p>Right now, we're only interested in indexing the columns we're actually searching in. To create our index, we need to execute the following query:</p><pre><code>CREATE INDEX idx_coins_symbol ON coins(symbol);</code></pre><p>Which indexes the entire column <strong>symbol</strong> on the table <strong>coins</strong> and stores it in <strong>idx_coins_symbol</strong>.</p><h1>Searching With Index</h1><p>Let's have a look at the execution plan the database comes up with after we've created the index. Again using the <code>EXPLAIN ANALYZE SELECT * FROM coins where symbol ='LOKA'</code> query.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hfky!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hfky!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 424w, https://substackcdn.com/image/fetch/$s_!hfky!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 848w, https://substackcdn.com/image/fetch/$s_!hfky!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 1272w, https://substackcdn.com/image/fetch/$s_!hfky!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hfky!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin" width="1456" height="434" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:434,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;indexed_where_loka_explain.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="indexed_where_loka_explain.png" title="indexed_where_loka_explain.png" srcset="https://substackcdn.com/image/fetch/$s_!hfky!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 424w, https://substackcdn.com/image/fetch/$s_!hfky!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 848w, https://substackcdn.com/image/fetch/$s_!hfky!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 1272w, https://substackcdn.com/image/fetch/$s_!hfky!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F653cd305-c6f5-48c5-87b7-ea7f970f23b4_1463x436.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What changed?</p><p>Our execution time went down from 0.847 ms to 0.046 ms. Our query is about 18 times faster after adding the index (0.847 / 0.046 ~ 18.4). This is because the database was able to pinpoint the rows location without scanning the whole table to find it due to the B-tree index.</p><p>Now you might say, what's all the fuzz? This whole indexing thing sounds rather complicated and we only sped things up by 18x. Well.. yes, because the <strong>coins</strong> table has only 10K rows in total. Our <code>SELECT</code> query isn't really a real-world use case yet. It's kept simple to make the concept clear. Let's have a look at some more realistic way of accessing data.</p><p>But first remove the index:</p><pre><code>DROP INDEX IF EXISTS idx_coins_symbol;</code></pre><h1>Joining Without Index</h1><p>A common - yet still not really representative - SQL operation for systematic traders is the fetching of all OHLCV rows for a given coin. For example to render its price history as a candlestick chart. Since we've linked the tables to one another using a <code>FOREIGN KEY</code> on the <strong>coin_id</strong> of the <strong>coins</strong> table, we need to utilize something like the <code>JOIN</code> Clause or chaining two <code>SELECT</code>s where we wirst find the coins <strong>id</strong> and then search for it in the <strong>ohlcv table</strong>. Using the <code>JOIN</code> clause is almost always superior because it gets executed in one go. The two <code>SELECT</code> statements would make two round-trips to the database, introducing <em>latency issues</em>, which are very nasty to deal with at scale.</p><pre><code>SELECT ohlcv.*
FROM ohlcv
JOIN coins ON ohlcv.coin_id = coins.id
WHERE coins.symbol = 'LOKA';</code></pre><p>It's execution plan looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Yykx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yykx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 424w, https://substackcdn.com/image/fetch/$s_!Yykx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 848w, https://substackcdn.com/image/fetch/$s_!Yykx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 1272w, https://substackcdn.com/image/fetch/$s_!Yykx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Yykx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin" width="1456" height="722" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:722,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;unindexed_join_exec_plan.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="unindexed_join_exec_plan.png" title="unindexed_join_exec_plan.png" srcset="https://substackcdn.com/image/fetch/$s_!Yykx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 424w, https://substackcdn.com/image/fetch/$s_!Yykx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 848w, https://substackcdn.com/image/fetch/$s_!Yykx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 1272w, https://substackcdn.com/image/fetch/$s_!Yykx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9be01b0f-61e5-4c94-9265-a0a93e5fdcce_1642x814.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It takes us 427.8 ms to get the data. The optimizer used a bunch of different methods to filter for it but again relied heavily on <code>SEQ SCAN</code> due to a missing index. Let's see how things change when we use an index:</p><h1>Joining With Index</h1><p>If we want to create an index for columns we're searching for, what columns do we need to consider? We're kind of accessing two different tables via two different columns here. First we scan the <strong>symbol</strong> column in the <strong>coins</strong> table to find the coins <strong>id</strong>, which we then use to find its corresponding rows in the <strong>ohlcv</strong> table. So at the very least, we should index the <strong>symbol</strong> column in the <strong>coins</strong> table.</p><pre><code>CREATE INDEX idx_coins_symbol ON coins(symbol);</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tEgJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tEgJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 424w, https://substackcdn.com/image/fetch/$s_!tEgJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 848w, https://substackcdn.com/image/fetch/$s_!tEgJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 1272w, https://substackcdn.com/image/fetch/$s_!tEgJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tEgJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin" width="1456" height="722" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:722,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;partly_indexed_join_execution.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="partly_indexed_join_execution.png" title="partly_indexed_join_execution.png" srcset="https://substackcdn.com/image/fetch/$s_!tEgJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 424w, https://substackcdn.com/image/fetch/$s_!tEgJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 848w, https://substackcdn.com/image/fetch/$s_!tEgJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 1272w, https://substackcdn.com/image/fetch/$s_!tEgJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ab5e32c-62ca-4bd1-9d5c-b127358926e9_1642x814.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This only midly sped up things. We're getting our coin <strong>id</strong> quicker but as we saw, this was only an improvement of 18x on the 10K rows. The planner is still not sure where to look for in the <strong>ohlcv</strong> table.</p><p>Let's put an index on the <strong>coin_id</strong> column in the <strong>ohlcv</strong> table too!</p><pre><code>CREATE INDEX idx_ohlcv_coin_id ON ohlcv(coin_id);</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6amg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6amg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 424w, https://substackcdn.com/image/fetch/$s_!6amg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 848w, https://substackcdn.com/image/fetch/$s_!6amg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 1272w, https://substackcdn.com/image/fetch/$s_!6amg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6amg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin" width="1456" height="490" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:490,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;join_both_indexed_plan.png&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="join_both_indexed_plan.png" title="join_both_indexed_plan.png" srcset="https://substackcdn.com/image/fetch/$s_!6amg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 424w, https://substackcdn.com/image/fetch/$s_!6amg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 848w, https://substackcdn.com/image/fetch/$s_!6amg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 1272w, https://substackcdn.com/image/fetch/$s_!6amg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe97d1d94-71ca-4ae5-9b96-620e3e991391_1611x542.bin 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The planner is now able to use and <code>INDEX SCAN</code> on both tables, which drastically decreases execution time from 427 ms down to 0.393 ms, a 1000x improvement.</p><h1>The gist of it</h1><p>Why do we gain a 1000x improvement all of a sudden, the first example only sped up things by 18x?</p><p>Because the first example was just a <code>SELECT</code> on a super tiny table. 10K rows is basically nothing. There's only so much performance improvement to be had for this small amount of data.</p><p>If we search in bigger tables or combine multiple tables, things get more spicy. Sifting through 10K rows one by one is a whole different story than doing the same on 10 million rows or more.</p><p>For now, every time we want to search in a <strong>column</strong>, we should put an index on it. As the datahub and its requirements grow, we're going to face different scenarios and will adapt to them by choosing the right indexing and accessing techniques.</p><p>To round this week of, simply include both b-trees in the sql seed file.</p><pre><code>CREATE INDEX idx_coins_symbol ON coins(symbol);
CREATE INDEX idx_ohlcv_coin_id ON ohlcv(coin_id);</code></pre><h2>- H&#333;r&#333;shi &#12496;&#12460;&#12508;&#12531;&#12489;</h2><p><em><strong>Disclaimer:</strong> The content and information provided by Vagabond Research, including all other materials, are for educational and informational purposes only and should not be considered financial advice or a recommendation to buy or sell any type of security or investment. Always conduct your own research and consult with a licensed financial professional before making investment decisions. Trading and investing can involve significant risk, and you should understand these risks before making any financial decisions</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.katanaquant.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Vagabond Research! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>