<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Database on Lorbic</title><link>http://localhost:1313/tags/database/</link><description>Recent content in Database on Lorbic</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 31 Jul 2026 23:00:00 +0530</lastBuildDate><atom:link href="http://localhost:1313/tags/database/index.xml" rel="self" type="application/rss+xml"/><item><title>Couchbase Index Best Practices and Query Performance Tuning</title><link>http://localhost:1313/couchbase-index-best-practices-performance-tuning/</link><pubDate>Fri, 31 Jul 2026 23:00:00 +0530</pubDate><guid>http://localhost:1313/couchbase-index-best-practices-performance-tuning/</guid><description>&lt;p>Most Couchbase performance tickets I have seen end the same way: someone adds more nodes, the dashboard looks a little better for a week, and the same query shows up in the slow log a month later. The node count was never the problem. The index was.&lt;/p>
&lt;p>This is a working reference, not an essay. I already wrote &lt;a href="http://localhost:1313/what-couchbase-taught-me-about-system-thinking/">the reflective version&lt;/a> of what indexing in Couchbase teaches you about systems in general. This post skips the reflection and gets straight to the decisions: which index type to reach for, how to order composite keys, how to tell if a query is actually using what you built, and which four or five mistakes account for most of the slow queries you will ever debug. Couchbase&amp;rsquo;s own documentation is the primary source for the recommendations below. Every example runs against &lt;code>travel-sample&lt;/code>, the sample bucket Couchbase ships with every install, so you can paste these into your own cluster and see the plan yourself.&lt;/p></description></item><item><title>Cache-Driven Development: Saving Your Database From Itself</title><link>http://localhost:1313/cache-driven-development/</link><pubDate>Wed, 22 Jul 2026 12:00:00 +0530</pubDate><guid>http://localhost:1313/cache-driven-development/</guid><description>&lt;p>There is a moment in every backend engineer&amp;rsquo;s life when their database starts refusing connections.&lt;/p>
&lt;p>Picture 2 a.m. on a Tuesday. The app is operating under normal traffic, nothing unusual. But the database connection pool is saturated. Queries are timing out. The monitoring dashboard shows 50,000 database operations per second, far beyond what the system should be handling.&lt;/p>
&lt;p>When someone pulls the slow-query logs, the pattern is immediately clear. The same query appears thousands of times:&lt;/p></description></item><item><title>How Multi-Tenant SaaS Actually Works</title><link>http://localhost:1313/how-multi-tenant-saas-works/</link><pubDate>Wed, 01 Jul 2026 00:00:00 +0530</pubDate><guid>http://localhost:1313/how-multi-tenant-saas-works/</guid><description>&lt;p>For the past month I have been reading about multi-tenant SaaS architecture. Not as an academic exercise. I kept running into the same questions on every project I looked at: where exactly does tenant data go, how do you stop one customer&amp;rsquo;s bug from becoming every customer&amp;rsquo;s problem, how does billing actually work at the database level. The blog posts I found were either too abstract or skipped the hard parts entirely.&lt;/p></description></item><item><title>Just About Go Time</title><link>http://localhost:1313/just-about-go-time/</link><pubDate>Sun, 10 May 2026 22:00:00 +0530</pubDate><guid>http://localhost:1313/just-about-go-time/</guid><description>&lt;p>Time is an illusion. Or more accurately, time is a political consensus poorly masquerading as physics.&lt;/p>
&lt;p>&lt;picture class="optimized-image-container">&lt;source srcset="http://localhost:1313/just-about-go-time/time-theory-meme_hu_c027f9156a69cf21.webp 480w, http://localhost:1313/just-about-go-time/time-theory-meme_hu_c74845a5e28401ee.webp 800w, http://localhost:1313/just-about-go-time/time-theory-meme_hu_22fbca4a5f8175a5.webp 1200w, http://localhost:1313/just-about-go-time/time-theory-meme_hu_c495ad8b67b2bacf.webp 1222w" sizes="(max-width: 800px) 100vw, 800px" type="image/webp">&lt;img src="http://localhost:1313/just-about-go-time/time-theory-meme_hu_c495ad8b67b2bacf.webp" width="1222" height="1514" alt="Time is relative, absolute, and a scam" loading="eager" decoding="async" fetchpriority="high" class="img-fluid" />
 &lt;/picture>&lt;/p>
&lt;p>If you&amp;rsquo;ve ever seen Dylan Beattie&amp;rsquo;s &amp;ldquo;Plain Text&amp;rdquo; &lt;a href="https://www.youtube.com/watch?v=gd5uJ7Nlvvo" target="_blank" rel="noopener noreferrer">talk&lt;/a>, you know that humans have spent centuries making data storage as complicated as possible. But text encoding has nothing on time zones.&lt;/p>
&lt;p>As engineers, we like to pretend that &lt;code>time.Now()&lt;/code> returns an objective truth. It doesn&amp;rsquo;t. It returns a snapshot of a highly contested, historically unstable set of political boundaries. In 2011, the island nation of Samoa decided they wanted to align their workweek with Australia rather than the United States. To do this, they didn&amp;rsquo;t just change their clocks; they completely skipped Friday, December 30th. At 11:59 PM on Thursday, the clock ticked over, and it was suddenly Saturday.&lt;/p></description></item><item><title>PostgreSQL Migrations in Go: Production Schema Patterns with Goose</title><link>http://localhost:1313/postgresql-migrations-in-go-production-schema-patterns-with-goose/</link><pubDate>Fri, 08 May 2026 22:00:00 +0530</pubDate><guid>http://localhost:1313/postgresql-migrations-in-go-production-schema-patterns-with-goose/</guid><description>&lt;p>Application code is stateless. You can tear down a container and spin up a new one in milliseconds without losing data. Databases are stateful. When you deploy new application logic that requires a new column, an index, or a table, you must transition the physical storage schema from state A to state B without destroying the underlying data or locking the system.&lt;/p>
&lt;p>This process is a database migration. Working with databases is the kind of thing I will gladly skip dinner for (:&lt;/p></description></item><item><title>ClickHouse data masking with regex</title><link>http://localhost:1313/clickhouse-regex-data-masking/</link><pubDate>Tue, 31 Mar 2026 22:30:00 +0530</pubDate><guid>http://localhost:1313/clickhouse-regex-data-masking/</guid><description>&lt;p>If you&amp;rsquo;re running a production observability stack, you&amp;rsquo;ve already leaked PII. An engineer forgot to redact an email in a log line, or a JWT token ended up in a stack trace.&lt;/p>
&lt;p>In most databases, the only fix is to &lt;code>DELETE&lt;/code> the data—killing your metrics along with the sensitive info. But ClickHouse has a more elegant approach: &lt;strong>Data Masking Policies&lt;/strong>.&lt;/p>
&lt;p>By defining a policy at the role level, you can use regex to swap sensitive patterns with &lt;code>[REDACTED]&lt;/code> in real-time, before the query results even leave the server.&lt;/p></description></item><item><title>ClickHouse vs. Postgres: When to Move Your Logs Out of a Relational DB</title><link>http://localhost:1313/clickhouse-vs-postgres-log-storage/</link><pubDate>Mon, 30 Mar 2026 22:45:00 +0530</pubDate><guid>http://localhost:1313/clickhouse-vs-postgres-log-storage/</guid><description>&lt;p>Postgres is the most reliable tool in my stack. It handles users, configurations, and complex relations without breaking a sweat. But databases, like any physical system, have a &amp;ldquo;design limit&amp;rdquo;. For Postgres, that limit usually appears when you try to use it as a dumping ground for high-velocity logs and metrics.&lt;/p>
&lt;p>When your &lt;code>ANALYZE&lt;/code> commands start taking minutes and your indexes consume more RAM than your data, you aren&amp;rsquo;t facing a Postgres bug; you&amp;rsquo;re facing an architectural mismatch.&lt;/p></description></item><item><title>Can ClickHouse Replace Vector Databases? HNSW, Benchmarks &amp; SQL Setup</title><link>http://localhost:1313/clickhouse-as-a-vector-database/</link><pubDate>Wed, 14 Jan 2026 20:00:00 +0530</pubDate><guid>http://localhost:1313/clickhouse-as-a-vector-database/</guid><description>&lt;p>Everyone&amp;rsquo;s building AI apps now. And every AI app needs a place to stash embeddings. The instant your data grows beyond &amp;ldquo;fits in memory&amp;rdquo;, you need a vector database. Or do you?&lt;/p>
&lt;p>If you&amp;rsquo;re already running ClickHouse for analytics, here&amp;rsquo;s some good news: you might not need another database. ClickHouse can hold its own as a vector store. Not because it was built for it, but because it&amp;rsquo;s built to be fast at everything.&lt;/p></description></item><item><title>OLTP vs OLAP - Why You Need Two Databases</title><link>http://localhost:1313/oltp-vs-olap-why-you-need-two-databases/</link><pubDate>Sun, 11 Jan 2026 21:00:00 +0530</pubDate><guid>http://localhost:1313/oltp-vs-olap-why-you-need-two-databases/</guid><description>&lt;p>At a recent ClickHouse conference in New Delhi, I attended this Saturday. There were many interesting sessions, but one that stood out was a talk on multi-tenant analytics at scale. I was reminded of a fundamental truth in backend engineering: &amp;ldquo;The database that runs your app cannot be the database that analyzes your app&amp;rdquo;.&lt;/p>
&lt;p>Early in a startup&amp;rsquo;s life, we shove everything into one database. User profiles, session data, logs, and analytics events all live in the same Postgres, Mongo, or Couchbase instance. It works, until it throttles.&lt;/p></description></item><item><title>Introducing CouchLens: A Query Analysis Tool for Couchbase</title><link>http://localhost:1313/couchlens-couchbase-query-analysis-tool/</link><pubDate>Sun, 28 Dec 2025 20:00:00 +0530</pubDate><guid>http://localhost:1313/couchlens-couchbase-query-analysis-tool/</guid><description>&lt;p>CouchLens is a client-side web application for analyzing Couchbase N1QL query performance. You feed it JSON exports from &lt;code>system:completed_requests&lt;/code>, &lt;code>system:indexes&lt;/code>, and schema inference results. It parses execution plans, computes metrics, detects inefficiencies, and generates a report showing where your queries are slow.&lt;/p>
&lt;p>Everything runs in the browser. No data leaves your machine. The tool is a Progressive Web App, so you can install it and use it offline. The goal is to give database administrators and developers a way to understand query behavior without writing custom scripts or debugging raw JSON.&lt;/p></description></item><item><title>What Couchbase Taught Me About System Thinking</title><link>http://localhost:1313/what-couchbase-taught-me-about-system-thinking/</link><pubDate>Tue, 18 Nov 2025 02:20:06 +0530</pubDate><guid>http://localhost:1313/what-couchbase-taught-me-about-system-thinking/</guid><description>&lt;h2 id="couchbase-internals-indexes-queries-consistency-and-performance">Couchbase Internals: Indexes, Queries, Consistency, and Performance&lt;a class="anchorjs-link" href="#couchbase-internals-indexes-queries-consistency-and-performance" aria-label="Link to section: Couchbase Internals: Indexes, Queries, Consistency, and Performance">&lt;/a>&lt;/h2>&lt;h3 id="introduction">Introduction&lt;a class="anchorjs-link" href="#introduction" aria-label="Link to section: Introduction">&lt;/a>&lt;/h3>&lt;p>Over the last few years I&amp;rsquo;ve lived deep inside backend systems, and for the past year and a half Couchbase has been my daily companion. Working with Go services that depend on Couchbase taught me that the real lessons aren&amp;rsquo;t in the marketing slides or quick‑start guides. They&amp;rsquo;re in the internals: how indexes are built, how queries are planned, how consistency flags change the story, and how durability levels quietly decide whether your system survives a failure or not.&lt;/p></description></item></channel></rss>