Using condition variables to wait for checkpoints

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Using condition variables to wait for checkpoints
Date: 2019-03-12 22:56:19
Message-ID: CA+hUKGLY7sDe+bg1K=bnEzOofGoo4bJHYh9+cDCXJepb6DQmLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

A user complained about CREATE DATABASE taking > 200ms even with fsync
set to off. Andres pointed out that that'd be the clunky poll/sleep
loops in checkpointer.c.

Here's a draft patch to use condition variables instead.

Unpatched:

postgres=# checkpoint;
CHECKPOINT
Time: 101.848 ms

Patched:

postgres=# checkpoint;
CHECKPOINT
Time: 1.851 ms

--
Thomas Munro
https://enterprisedb.com

Attachment Content-Type Size
0001-Use-condition-variables-to-wait-for-checkpoints.patch application/octet-stream 5.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-03-12 23:12:04 Re: Using condition variables to wait for checkpoints
Previous Message Tomas Vondra 2019-03-12 22:54:31 Re: performance issue in remove_from_unowned_list()