Dear PostgreSQL Community, I am trying to better understand PostgreSQL checkpoints internally, so I was thinking about this scenario.

Lets say we have checkpoint_timeout 15 mins and checkpoint_completion_target 0.85. Now if we face a case when one checkpoint for some reason takes lets say 20 minutes, for example

1:00PM - checkpoint1 started

1:15PM checkpoint timeout fired but checkpoint1 is still running (checkpoint2 here was scheduled)

1:20PM - checkpoint1 finished

My question is will the next checkpoint trigger right away at 1:20PM or will it be suspended and started at 1:30 as initially scheduled? I assume that two checkpoints cannot overlap. ( For now lets do not discuss other affecting parameters as max_wal_size, which can also trigger)

So does the checkpoint1 write ALL the dirty buffers to the disk, so we have very clean state at 1:20 so there is no need for the second checkpoint to start? As far as I understand the old checkpoint will not touch pages which were dirtied after its start, so in this case there is a need for the new checkpoint to just fire after the old one finishes.

Also, will checkpoint_timeout scheduling be switched any way? Like scheduled to run late for as much time as was the previous one delayed, or is it not alterable?

I will be more than happy if you can share more details regarding internal insights.

1 Answer 1


Only one checkpoint can run at a given time, so if the previous checkpoint is still in progress, the next checkpoint has to wait until the first one is done. The second checkpoint should begin soon after the previous one is done.

The second checkpoint might have less work to do, but buffers can become dirty again while the first checkpoint is in progress, so the second checkpoint won't have nothing to do.

PostgreSQL won't adjust checkpoint_timeout, but if more than max_wal_size WAL has been written since the latest checkpoint, another checkpoint is started. The idea is to keep crash recovery time limited.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.