<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Postgresql - Tag - Tonderai Khatai</title><link>https://tldkhatai.com/tags/postgresql/</link><description>Postgresql - Tag - Tonderai Khatai</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 06 Oct 2026 00:02:00 +0100</lastBuildDate><atom:link href="https://tldkhatai.com/tags/postgresql/" rel="self" type="application/rss+xml"/><item><title>Compare-and-Swap Updates in PostgreSQL, Explained</title><link>https://tldkhatai.com/posts/postgres-cas-explained/</link><pubDate>Tue, 06 Oct 2026 00:02:00 +0100</pubDate><author>Tonderai Khatai</author><guid>https://tldkhatai.com/posts/postgres-cas-explained/</guid><description><![CDATA[<div class="featured-image">
                <img src="/images/posts/postgres-cas-explained.png" referrerpolicy="no-referrer">
            </div><p>Compare-and-swap means: change this row, but only if it is still what I last saw. In SQL that&rsquo;s an <code>UPDATE</code> with a guard in the <code>WHERE</code> clause, and you check how many rows it touched.</p>]]></description></item><item><title>PostgreSQL FOR UPDATE SKIP LOCKED, Explained</title><link>https://tldkhatai.com/posts/postgres-skip-locked-explained/</link><pubDate>Tue, 06 Oct 2026 00:01:00 +0100</pubDate><author>Tonderai Khatai</author><guid>https://tldkhatai.com/posts/postgres-skip-locked-explained/</guid><description><![CDATA[<div class="featured-image">
                <img src="/images/posts/postgres-skip-locked-explained.png" referrerpolicy="no-referrer">
            </div><p><code>FOR UPDATE</code> locks the rows a query returns. Add <code>SKIP LOCKED</code> and a row that another transaction has already locked is skipped instead of waited for.</p>]]></description></item><item><title>SKIP LOCKED vs CAS in PostgreSQL</title><link>https://tldkhatai.com/posts/postgres-skip-locked-vs-cas/</link><pubDate>Tue, 06 Oct 2026 00:00:00 +0100</pubDate><author>Tonderai Khatai</author><guid>https://tldkhatai.com/posts/postgres-skip-locked-vs-cas/</guid><description><![CDATA[<div class="featured-image">
                <img src="/images/posts/postgres-skip-locked-vs-cas.png" referrerpolicy="no-referrer">
            </div><p>Eight workers poll the same <code>jobs</code> table. Each job must be processed by exactly one of them. Two PostgreSQL tools solve this, <code>FOR UPDATE SKIP LOCKED</code> and compare-and-swap (CAS), and on the same workload one claimed every job it tried for while the other lost most of its attempts.</p>]]></description></item></channel></rss>