Welcome to my blog

Sometimes, I feel the need to write, and this is a place where I can share what I write with others. I hope you find something interesting here. To learn more about me, you can visit the about page, or perhaps you want to take a look at my projects.

Consider using array operators over the SQL in operator

In my post about batch operations, I used the where id = any(:ids) pattern, with ids bound to a JDBC array. I’ve gotten questions about that afterwards, asking why I do it like that, instead of using in (:id1, :id2, ...). Many libraries can take care of the dynamic SQL generation for you, so often you can just write in (:ids), just like the array example. I would still prefer to use the = any(:ids) pattern, and I decided to write down my reasoning here....

September 21, 2024 · 4 min · 674 words · Robin Kåveland

Batch operations using composite keys in postgres over jdbc

Throughout a career as a software developer, you encounter many patterns. Some appear just often enough to remember that they exist, but you still need to look them up every time. I’ve discovered that writing things down helps me remember them more easily. This particular pattern is very useful for my current project. So, it’s time to write it down and hopefully commit it to memory properly this time. Although this post is specific to PostgreSQL, I’m sure other databases have the necessary features to achieve the same results efficiently....

August 30, 2024 · 5 min · 927 words · Robin Kåveland

Norwegian Wild Salmon Fishing Ban of 2024

For this blog post, I’m trying something different. This is a jupyter notebook that I’m using to study some data, and just dumping my brain out in text. If I can easily export this to a format that works with hugo, this might become a common occurrence. For this one, I’m leaving the code in. There isn’t that much of it, but I think it’s fun to show how much visualization per line of code you can get with seaborn and pandas....

June 27, 2024 · 6 min · 1245 words · Robin Kåveland

Using short lived postgres servers for testing

Database servers are usually long-lived, and important parts of the infrastructure that we build on. We rarely set them up from scratch, because we have to take such good care of them over time. I think this causes a lot of people to think that setting up a database server is some mysteriously difficult ordeal. To be clear, that’s actually true, if you need high availability and a solid recovery point objective....

May 27, 2024 · 6 min · 1082 words · Robin Kåveland

Building documentation for Eugene

I’ve been busy working on a documentation site for eugene, and I think it’s starting to look pretty good. I wanted to write down some of my thoughts around the process so far, and some of the things I’ve learned. It’s just been a few days since I ported my blog to hugo, so since I was already feeling like I was up to speed on that, I decided I’d try using it for the eugene documentation too....

May 20, 2024 · 7 min · 1343 words · Robin Kåveland

Moving the blog to Hugo

I’ve been using pelican for my blog for a while now, and I don’t really have anything negative to say about it. But for a while, I’ve been wanting a more minimal theme. I ended up on the front page of hacker news a couple of times, and the old theme had my face on all the pages, which made me feel a bit uncomfortable. I was looking at some other themes around the web, and I found PaperMod which I absolutely loved....

May 18, 2024 · 1 min · 212 words · Robin Kåveland

Linting postgres migration scripts

I have been working quite a bit on picking up dangerous migration patterns in migration scripts over at the eugene repository lately. A major feature I’ve added is syntax tree analysis, so that we can pick up some patterns without having to run the SQL scripts. This isn’t quite as precise as running the scripts, but it’s a lot faster and can catch quite a few common mistakes. So let’s take a look at how it works!...

May 16, 2024 · 7 min · 1475 words · Robin Kåveland

Porting an application from cats effects to ZIO

In my current project, we’re working on a large-ish code base that is written in Scala and uses cats effect as an effect system in large parts of the code base. If you’re not familiar with what an effect system is, I think the most important detail is that it’s a tool that gives you certain superpowers if you promise to be honest about it when your code does things that can be considered “effectful”, such as interacting with the network or reading files....

May 16, 2024 · 8 min · 1649 words · Robin Kåveland

Careful with That Lock, Eugene: Part 2

A while back, I wrote Careful with That Lock, Eugene about an idea for how to check if a database migration is likely to disturb production. That post came about after having an inspiring chat with a colleague about the advantages of transactional migration scripts and the ability to check the postgres system catalog views before committing a transaction. Over the past few weeks, I’ve been experimenting with this idea to test if I can use it to build valuable safety checks for DDL migrations....

May 6, 2024 · 13 min · 2581 words · Robin Kåveland

Careful with That Lock, Eugene

It is rewarding to work on software that people care about and use all around the clock. This constant usage means we can’t simply take the system offline for maintenance without upsetting users. Therefore, techniques that allow us to update the software seamlessly without downtime or compromising service quality are incredibly valuable. Most projects I’ve worked on use a relational database for persistence, and have some sort of migration tool like flyway or liquibase to make changes to the database schema....

April 12, 2024 · 9 min · 1759 words · Robin Kåveland