PostgreSQL Experts™

...because your data is your business

 
Nov. 15, 2019, 9 a.m.

Why submit a paper to PgDay 2020?

If you have something interesting to day about PostgreSQL, we [would love to get a proposal from you]. Even if you have never spoken before, consider responding to the CfP! PgDay 2020 is particularly friendly to first-time and inexperienced speakers. You’re among friends! If you use PostgreSQL, you almost certainly have opinions and experiences that […]


More Blogs by Christophe Pettus
Nov. 13, 2019, 12:26 p.m.

PgDaySF 2020!

The very first PgDay San Francisco is coming to the Swedish-American Hall on January 21, 2020. It’s going to be an amazing event. If you have something to say about PostgreSQL… … the Call for Proposals is now open through November 22, 2019. We are looking for 40 minute talks about anything related to PostgreSQL. […]


More Blogs by Christophe Pettus
March 20, 2019, 6:34 a.m.

“Look It Up: Practical PostgreSQL Indexing” at Nordic PGDay 2019

The slides from my presentation at PGDay Nordic 2019 are now available.


More Blogs by Christophe Pettus
Feb. 11, 2019, 2:44 p.m.

What’s up with SET TRANSACTION SNAPSHOT?

A feature of PostgreSQL that most people don’t even know exists is the ability to export and import transaction snapshots. The documentation is accurate, but it doesn’t really describe why one might want to do such a thing. First, what is a “snapshot”? You can think of a snapshot as the current set of committed […]


More Blogs by Christophe Pettus
Feb. 8, 2019, 5:52 p.m.

Do not change autovacuum age settings

PostgreSQL has two autovacuum-age related settings, autovacuum_freeze_max_age, and vacuum_freeze_table_age. Both of them are in terms of the transaction “age” of a table: That is, how long it has been since the table has been scanned completely for “old” tuples that can be marked as “frozen” (a “frozen” tuple is one that no open transaction can […]


More Blogs by Christophe Pettus
Feb. 4, 2019, 1 p.m.

“Breaking PostgreSQL at Scale” at FOSDEM 2019

"Breaking PostgreSQL at Scale" at FOSDEM 2019.


More Blogs by Christophe Pettus
Sept. 26, 2018, 11:06 a.m.

Find the value of all database sequences

Upon occasion, you want to get the current value of all the sequences in the database. For example, you may have fields that are integer rather than bigint, and you’re concerned how close you are to overflowing one of them (since sequences are bigint and will happily crash through the size of a 32-bit integer). […]


More Blogs by Christophe Pettus
Sept. 12, 2018, 8:22 p.m.

“Securing PostgreSQL” at PDXPUG PostgreSQL Day 2018

The slides from my presentation, Securing PostgreSQL at PDXPUG PostgreSQL Day 2018 are now available.


More Blogs by Christophe Pettus
Sept. 4, 2018, noon

CHAR: What is it good for?

In addition to the familiar text types VARCHAR and TEXT, PostgreSQL has a type CHAR. It’s little used… and that’s for a reason. It has some very unusual behaviors, which can be quite a surprise if you are not expecting them. First, CHAR is a fixed-width type. When character data is stored in it, it’s […]


More Blogs by Christophe Pettus
Aug. 28, 2018, 5 p.m.

Don’t LOCK tables. Just don’t.

It’s not uncommon that an application needs to serialize access to one or more resources. The temptation is very high to use the LOCK TABLE SQL statement to do this. Resist the temptation. There are many issues with using LOCK: It blocks autovacuum, which can cause bloat or even transaction ID wraparound in extreme cases. […]


More Blogs by Christophe Pettus
Aug. 9, 2018, 10:06 a.m.

Three Steps to pg_rewind Happiness

pg_rewind is a utility included with PostgreSQL since 9.x. It’s used to “rewind” a server so that it can be attached as a secondary to a primary. The server being rewound could be the former primary of the new primary, or a secondary that was a peer of the new primary. In pg_rewind terminology, and […]


More Blogs by Christophe Pettus
Aug. 7, 2018, 5:58 p.m.

Does anyone really know what time it is?

PostgreSQL has a variety of ways of telling time: now(), statement_timestamp(), and clock_timestamp(). Each has a different sense of when “now” is: now() is the time at the start of the transaction; it never changes while the current transaction is open. statement_timestamp() is the time that the current statement started running. It changes from statement […]


More Blogs by Christophe Pettus
July 23, 2018, 9 a.m.

One of those things: pgbouncer and self-signed certificates

(This is another intermittent series of small things that are easy to forget, and cause irritation in the PostgreSQL world…) Since version 1.7, pgbouncer has had built-in TLS support. This is very handy, since the previous versions required stunnel or something similar to provide TLS. Frequently, either for test purposes or because you’re in an […]


More Blogs by Christophe Pettus
July 18, 2018, 9 a.m.

pg_rewind and checkpoints: caution!

pg_rewind, introduced in PostgreSQL 9.5, is a powerful utility solving a particular problem: If you have a promoted a streaming replication secondary into being a primary, how can you make sure that the former primary, and any other secondaries that used to be connected to it, are able to connect to the new primary? Previously, […]


More Blogs by Christophe Pettus
July 17, 2018, 10:38 a.m.

That Google Checksum Tool

Google recently released a tool to check on-disk checksums in PostgreSQL. PostgreSQL being hot, and Google being Google, this generated a lot of press, much of it containing an element of FUD about the integrity of PostgreSQL backups (note that Google’s own announcements were quite straight-forward about it). First, some background: Since PostgreSQL 9.3, it […]


More Blogs by Christophe Pettus
July 16, 2018, 8:33 p.m.

One of those things: /tmp/pgpool_status

(This is another intermittent series of small things that are easy to forget, and cause irritation in the PostgreSQL world…) When setting up pgpool2, it’s common to tweak the configuration file repeatedly… and often get a hostname wrong. One common occurrence is then: You fix the hostnames. You restart pgpool2. It refuses to connect to […]


More Blogs by Christophe Pettus
May 10, 2018, noon

PostgreSQL Replication at PerconaLive 2018

The slides from my talk on PostgreSQL Replication at PerconaLive 2018 are available.


More Blogs by Christophe Pettus
April 10, 2018, 6:36 p.m.

Change these: wal_level and wal_hint_bits

(An intermittent series on PostgreSQL parameters whose default settings you should change.) wal_level = logical wal_level controls how much information is written into the write-ahead log. Higher settings write more information, enabling more features, at the expense of (somewhat) larger write-ahead log volume. Just set it to logical, the highest setting. The incremental volume is […]


More Blogs by Christophe Pettus
April 6, 2018, 8 a.m.

Change these: Logging

(An intermittent series on PostgreSQL parameters whose default settings you should change.) Here’s my preferred logging configuration: log_destination = 'csvlog' logging_collector = on log_directory = '/var/log/postgresql' log_filename = 'postgresql-%Y%m%d-%H%M%S.log' log_rotation_size = 1GB log_rotation_age = 1d log_min_duration_statement = 250ms log_checkpoints = on log_connections = on log_disconnections = on log_lock_waits = on log_statement = 'ddl' log_temp_files = […]


More Blogs by Christophe Pettus
April 3, 2018, 1 p.m.

Change these: archive_mode and archive_command

(An intermittent series on PostgreSQL parameters whose default settings you should change.) By default archive_mode is set to off, and thus archive_command is ignored. Even if you are not going to be using WAL archiving, you should change these. You can use settings such as: archive_mode = on archive_command = '/bin/true' It requires a server […]


More Blogs by Christophe Pettus
March 30, 2018, 9:28 p.m.

Change This: wal_compression

(An intermittent series on PostgreSQL parameters whose default settings you should change.) Introduced in PostgreSQL 9.5, wal_compression is off by default, but you should probably turn it on. First, what does it do? The documentation helpfully explains: When this parameter is on, the PostgreSQL server compresses a full page image written to WAL when full_page_writes […]


More Blogs by Christophe Pettus
March 27, 2018, 6:12 p.m.

Mountpoints and the Single PostgreSQL Server

Ultimately, a PostgreSQL database is just files, and those files have to be stored somewhere. Absent tablespaces, they are all stored in a single directory structure, traditionally called PGDATA. While smaller instllations can just use the defaults associated with the packaging, larger databases are often installed on their own volume with its own mountpoint. Two […]


More Blogs by Christophe Pettus
March 20, 2018, 6:28 a.m.

Why PostgreSQL is Terrible? at Nordic PGDay

The slides from my talk at Nordic PGDay, Why PostgreSQL is Terrible, are now available.


More Blogs by Christophe Pettus
Jan. 2, 2018, 10 p.m.

A Replication Cheat-Sheet

So many types of replication, so little time! What kind of PostgreSQL replication should you use?


More Blogs by Christophe Pettus
Oct. 30, 2017, 2 p.m.

Commitment Issues

One of the essentials of any database system is that a transaction is either in progress, committed, or rolled back. But consider what happens if… BEGIN; UPDATE table SET money=money+100000; COMMIT; -- And you get an error that the server has disconnected Did that transaction commit, or didn’t it? You don’t really know, because you […]


More Blogs by Christophe Pettus