Skip to content

Open source Team

Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.

721 posts since September 2011

PostgreSQL 15: read some options for pg_dump from a file

PostgreSQL 15 will probably come with a new feature for pg_dump: Instead of passing the arguments/options directly to pg_dump when it is executed, you may also use a file to describe what you want to export. In the Oracle world it was (maybe still is, but I don’t know) very popular to do that with traditional exp/imp and the expdp/impdp… 

PostgreSQL Flexible Server on Azure, scram-sha-256 workaround

Microsofts old Single Server for PostgreSQL on Azure offers password encryption md5 only, normaly IT Governance responsible people getting nervous by that. On the new Flexible Server for PostgreSQL on AZure md5 is still the default setting, but a workaround makes scram-sha-256 posssible to use. Since PostgreSQL 10 it is possible to switch from md5 to scram-sha-256, by using community… 

Why does my first tablespace in PostgreSQL always get the OID 16384?

For those already familiar with this topic and wonder about the heading, hold on and continue reading. One of the exercises we do in our PostgreSQL DBA Essentials workshop is to create a tablespace. This is to demonstrate how tablespaces work in PostgreSQL and, especially to show the symbolic link that gets created in $PGDATA/pg_tblspc. In one of the last… 

How to efficiently add constraints to existing tables in PostgreSQL

Is is not a surprise that applications change over time. New tables get added, columns need to be changed or new ones are required, and sometimes you need to add check constraints or foreign keys to already existing tables which contain data. The issue with adding constraints to tables that already contain data is, that PostgreSQL needs to scan the… 

PostgreSQL indexes and operators

Creating a standard B-tree index in PostgreSQL is nothing special and usually we do it without thinking about what happens in the background. For the standard data types like e.g. int or text we do not need to know anything about operators or operator classes. In those cases the standard operator class for the data type is applied and all… 

Some basics about time zones in PostgreSQL

As soon as you have an application which works across time zones you will have to deal with that properly in the database. I’ve seen many applications that didn’t care of that at the beginning, and much work had to be done to change the implementation afterwards. The one and only recommendation is: Do it properly from the beginning and… 

In which order do triggers fire in PostgreSQL?

When you are working with triggers it might be important to know in which order they fire. Of course, a “before” triggers fires before an “after” trigger. But what happens if you have two or more triggers for the same event? Maybe you want to make sure that a specific trigger is executed first (for whatever reason) or you want… 

How much shared memory is PostgreSQL using? (2) – details

In the last post in this two post series we’ve briefly looked at configuring huge pages on Linux for PostgreSQL. It became clear, that calculating the number of huge pages purely based on the setting of shared_buffers will not work. PostgreSQL requires more shared memory, but what exactly is it? Well, this is the goal of this post and I’ll… 

How much shared memory is PostgreSQL using? (1) – basics

Have you ever wondered if the value of shared_buffers is the only setting which controls how much shared memory PostgreSQL is actually using? There was a nice addition committed to PostgreSQL 15 recently, which helps in answering this question (more on that later). shared_buffers for sure is the biggest chunk of shared memory that PostgreSQL is using but there might… 

Temporal tables for PostgreSQL 15?

One of the features which is currently missing in PostgreSQL is Temporal Tables. Other database systems have that since a long time and many people want to have in PostgreSQL as well. If you don’t know what it is, here is a short overview. Basically you can ask for a row as it was at a specific point in time.… 

Parallel distinct for PostgreSQL 15

When parallel execution was introduced with PostgreSQL 9.6 it was quite limited and supported only a few operations to run in parallel. Over time more and more operations were enabled to run in parallel. When PostgreSQL 15 will be released next year it will come with parallel distinct. Here is an easy example: If you do something like this, e.g.… 

What are those *_init files for in PostgreSQL?

Quite some time ago I’ve written about relation files in PostgreSQL and when they get created. In that post we talked about the files containing the actual data, the free space map (fsm) and the visibility map (vm). But this is not all, there is another kind of file you might spot if you take a look into the directory…