Re: Checkpoint versus Background Writer

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Shiv Sharma <shiv(dot)sharma(dot)1835(at)gmail(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Checkpoint versus Background Writer
Date: 2013-12-27 22:29:44
Message-ID: CAL_0b1swRu=jj+PKBrQi1pGwA2i8SqHgkbK-rVemvQY1xQBzWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Dec 27, 2013 at 11:46 AM, Shiv Sharma
<shiv(dot)sharma(dot)1835(at)gmail(dot)com> wrote:
> They seem to do similar things: clear dirty buffers from shared_buffers to
> disk.
>
> So why have 2 processes with seperate semantics (seperate set of config
> partms) ?

AFAIU, they serve for completely different purposes.

Background writer is for performance. Each round, based on shared
memory usage statistics and LRU data, it estimates how many new pages
user backend processes will require before the next round, and flushes
necessary amount of dirty pages on disk. So user backend processes
will have enough non-dirty pages to operate with, and wont need to
spend time on doing flushing themselves, that allows to return control
to users faster.

Checkpoints is a part of reliability mechanism. It applies changes
accumulated in WAL files, that have not been applied earlier by
background writer or user backends, to data files, keeping the
database consistent before performing rotation.

Correct me if I missed or misunderstood something.

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

http://www.linkedin.com/in/grayhemp
+1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979
gray(dot)ru(at)gmail(dot)com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2013-12-29 00:13:26 Re: Checkpoint versus Background Writer
Previous Message Shiv Sharma 2013-12-27 20:41:58 Re: Checkpoint versus Background Writer