Kaarel's corner Kaarel's corner https://kmoppel.github.io/ CSI: Postgres — Did someone change my table?? PostgreSQL has many small “hidden gem” features included (not to mention ~1K extensions adding a bunch more) waiting for someone to notice them. Some are useful every day, some are niche, and some (e.g. debug_* settings) exist only so that core developers could troubleshoot things without losing too much hair.... Sat, 24 Jan 2026 00:00:00 +0200 https://kmoppel.github.io/2026-01-24-csi-postgres-did-someone-change-my-table/ https://kmoppel.github.io/2026-01-24-csi-postgres-did-someone-change-my-table/ Postgres, Kafka and event queues After stumbling on a pair of interesting blog posts — You Don’t Need Kafka, Just Use Postgres (Considered Harmful) — somewhat in the style of good old “flame wars” (which are increasingly rare these days) in the recent Postgres Weekly, as a response to a previous article — Kafka is... Thu, 13 Nov 2025 00:00:00 +0200 https://kmoppel.github.io/2025-11-13-postgres-kafka-and-event-queues/ https://kmoppel.github.io/2025-11-13-postgres-kafka-and-event-queues/ A "TPC-C"-like "extension-pack" for pgbench TPC-C is supposedly the most objective performance measurement of OLTP database systems… and I’ve used it quite a fair bit over the years as well…yet, running it on Postgres is sadly not exactly as smooth as things typically are with Postgres 😔 If to compare at least with the wonderful... Sat, 06 Sep 2025 00:00:00 +0300 https://kmoppel.github.io/2025-09-06-introducing-pgbench-tpcc-like-toolkit/ https://kmoppel.github.io/2025-09-06-introducing-pgbench-tpcc-like-toolkit/ No, you don't necessarily need extensions to compact Postgres tables Broadcasting a quick tip from a real-life “tasklet” where a customer was genuinely surprised why a seemingly logical fix didn’t show up on Google / LLM-s. So let’s see if we can improve on that situation. So in short a large central table was getting too bloated (fragmented) and query... Wed, 06 Aug 2025 00:00:00 +0300 https://kmoppel.github.io/2025-08-06-no-you-dont-need-extensions-to-compact-postgres-tables/ https://kmoppel.github.io/2025-08-06-no-you-dont-need-extensions-to-compact-postgres-tables/ TIL - Debian comes with a pg_virtualenv wrapper! Some weeks ago Postgres (well, not directly the official Postgres project) again managed to surprise me during my daily muscle-memory operations, prompting even one relatively lazy human to actually write about it. So while minding some other common Postgres business, I double-tapped “Tab” to complete on “pg_v”, looking for pg_verifybackup... Tue, 15 Jul 2025 00:00:00 +0300 https://kmoppel.github.io/2025-07-15-til-pg-createvirtualenv/ https://kmoppel.github.io/2025-07-15-til-pg-createvirtualenv/ Yes, Postgres can do session vars - but should you use them? Animated by some comments / complaints about Postgres’ missing user variables story on a Reddit post about PostgreSQL pain points in the real world - I thought I’d elaborate a bit on sessions vars - which is indeed a little known Postgres functionality. Although this “alley” has existed for ages... Tue, 03 Jun 2025 00:00:00 +0300 https://kmoppel.github.io/2025-06-03-yes-postgres-can-do-session-variables-but-should-you-use-them/ https://kmoppel.github.io/2025-06-03-yes-postgres-can-do-session-variables-but-should-you-use-them/ Striping Postgres data volumes - a free lunch? A small follow up on my previous post on various Postgres scale-up avenues in my preferred order. The post received quite a bit of interest - meaning people at least still “wish” performant databases :) And - the ones who are willing to put in a bit of effort with... Thu, 24 Apr 2025 00:00:00 +0300 https://kmoppel.github.io/2025-04-24-is-striping-postgres-data-volumes-a-free-lunch/ https://kmoppel.github.io/2025-04-24-is-striping-postgres-data-volumes-a-free-lunch/ A roadmap to scaling Postgres After meeting with another database fellow recently - the evergreen topic of database scaling popped up again. That won’t go out of fashion anytime soon I guess, despite the AI advancements and the rise of Postgres-aware chatbots a la Xata Agent. Namely - when to grab for which designs, technical... Thu, 10 Apr 2025 00:00:00 +0300 https://kmoppel.github.io/2025-04-10-postgres-scaling-roadmap/ https://kmoppel.github.io/2025-04-10-postgres-scaling-roadmap/ TIL - Starting in read-only mode the easy way Once a year or so Postgres manages to surprise me for some of those daily DB micro-operations, that come from muscle memory usually, without any braincells spent. Today to my delight I stumbled on one such again - for the task of starting a psql session in a safe read-only... Thu, 27 Mar 2025 00:00:00 +0200 https://kmoppel.github.io/2025-03-27-til-starting-in-read-only-the-easy-way/ https://kmoppel.github.io/2025-03-27-til-starting-in-read-only-the-easy-way/ Don't forget about the Postgres parallel leader participation setting Recently there was a nice article on the Planet PostgreSQL feed on Postgres’ parallel query capabilities and the pertinent tuning parameters. All good and logical, the main settings and considerations were highlighted…but then I suddenly remembered that there’s one more parallelism relevant parameter that for some reason is mostly always... Wed, 22 Jan 2025 00:00:00 +0200 https://kmoppel.github.io/2025-01-22-dont-forget-about-postgres-parallel-leader-participation/ https://kmoppel.github.io/2025-01-22-dont-forget-about-postgres-parallel-leader-participation/ Postgres Synchronous Replication - a 99.99% guarantee only At last week’s local Postgres user group meetup here in Estonia, one of the topics was HA and recent Patroni (the most popular cluster manager for Postgres) improvements in supporting quorum commit, which by the way on its own has been possible to use for years. Things went deep quickly... Mon, 09 Dec 2024 00:00:00 +0200 https://kmoppel.github.io/2024-12-09-postgres-sync-replication-data-safety/ https://kmoppel.github.io/2024-12-09-postgres-sync-replication-data-safety/ Postgres User Group Tallinn next event on 27th of November Meet Postgres User Group Tallinn / Estonia Just a short shout-out to maybe get an extra attendee or two - as actually appeared that we’ve never done any advertising for our local Estonian Postgres User Group on the Postgres feed at all - although we’ve been out there since years... Sat, 23 Nov 2024 00:00:00 +0200 https://kmoppel.github.io/2024-11-23-pgug-tallinn-meetup-next-week/ https://kmoppel.github.io/2024-11-23-pgug-tallinn-meetup-next-week/ Postgres on Spot VMs - only for the crazy? Postgres is already great, surely - even “too popular” one could complain with a twist…as this broadcast “was” actually supposed to be my Lightning Talk at last month’s pgConf.eu in Athens 🙂 But indeed, seems Postgres has in an awesome way gotten so big that it’s not like that anymore... Tue, 19 Nov 2024 00:00:00 +0200 https://kmoppel.github.io/2024-11-19-postgres-on-spot-vms-only-for-the-crazy/ https://kmoppel.github.io/2024-11-19-postgres-on-spot-vms-only-for-the-crazy/ Cloning Postgres user privileges vs ChatGPT At pgConf.eu in Athens - by the way, reported to be the largest PostgreSQL conference to date, attesting to the software’s undeniable success! - I got into a sort of interesting hallway discussion. I guess my chat companion was relatively new to the ecosystem - and said something along the... Tue, 05 Nov 2024 00:00:00 +0200 https://kmoppel.github.io/2024-11-05-cloning-postgres-user-privileges-vs-chatgpt/ https://kmoppel.github.io/2024-11-05-cloning-postgres-user-privileges-vs-chatgpt/ A TimescaleDB analytics trick While everyone agrees that Postgres has a lot of really nice things going for it, the analytics story has lagged a bit as there are some hard problems to be solved - the on-disk format would have to be changed or IO-layer abstracted away even further to allow alternative engines,... Mon, 19 Aug 2024 00:00:00 +0300 https://kmoppel.github.io/2024-08-19-a-timescaledb-analytics-trick/ https://kmoppel.github.io/2024-08-19-a-timescaledb-analytics-trick/ Best pg_basebackup compression settings for v15 and above In my last post I did a quick check on the performance of the newer (lz4, zstd) pg_dump compression options, which included setting up a small framework to download some openly available “real life”-ish sample datasets. And the general result was that, indeed - the new algos in lower levels... Wed, 27 Mar 2024 00:00:00 +0200 https://kmoppel.github.io/2024-03-27-best-basebackup-compression-settings-for-v15-and-above/ https://kmoppel.github.io/2024-03-27-best-basebackup-compression-settings-for-v15-and-above/ Best pg_dump compression settings for Postgres in 2024 Time between Christmas and New Year is always a good quiet time to be able to concentrate and tick off some mouldy TODO list items. For me this time the top item was a script (which turned into a small framework somehow), to download and import some openly available “real... Fri, 05 Jan 2024 00:00:00 +0200 https://kmoppel.github.io/2024-01-05-best-pgdump-compression-settings-in-2024/ https://kmoppel.github.io/2024-01-05-best-pgdump-compression-settings-in-2024/ TIL - When was my Postgres cluster initialized ? Today again a nice finding after 12 years with Postgres - seems one can actually retrieve the time when a cluster / instance was once initialized! Given of course you haven’t dump-restored or in-place upgraded the instance in the mean time… So far on those rare occasions when I’ve actually... Thu, 28 Sep 2023 00:00:00 +0300 https://kmoppel.github.io/2023-09-28-til-when-was-my-postgres-cluster-initialized/ https://kmoppel.github.io/2023-09-28-til-when-was-my-postgres-cluster-initialized/ Postgres 16 - a quick perf check “That time of the year”™ again 🎉 As per usual for that “season” - not that I don’t trust the PostgreSQL Global Development Group and its performance farm (they did catch some performance regressions in beta stages!) - but somehow as soon as a new major release arrives, I get... Sun, 24 Sep 2023 00:00:00 +0300 https://kmoppel.github.io/2023-09-24-postgres-v16-quick-perf-check/ https://kmoppel.github.io/2023-09-24-postgres-v16-quick-perf-check/ TIL - IN is not the same as ANY Not exactly from today, rather from a month or two ago, but still on my “noteworthy list”. So after a remarkably long quiet period of no surprises (Postgres doesn’t generally surprise one badly), I managed to learn something controversial - a thing considered generally good, using ANY instead of IN-list... Tue, 04 Jul 2023 00:00:00 +0300 https://kmoppel.github.io/2023-07-04-til-in-is-not-the-same-as-any/ https://kmoppel.github.io/2023-07-04-til-in-is-not-the-same-as-any/