Thread: why we need both the collector & buffer process

why we need both the collector & buffer process

From
"William.Jiang"
Date:
<p>hi,all hackers of postgres<p>    when postmaster start as a service . another two processes(collector & buffer )
starttheir work at the same time.<p>   I have read the code and I am wondering why we need two processes to do the
work.I think one process can work as well. Are there something special you considered when you developed this
feature?<p> Best wishes!<p>  William<p><br /><p><br /><hr size="1" /><b>Do You Yahoo!?</b><br /><a
href="http://rd.yahoo.com/mail_cn/tag/?http://ad.cn.doubleclick.net/clk;4983632;7740969;c?http://www.ibm.com/cn/promotion/optin/reg.shtml">"IBM优惠价特权,谁先来谁先得!"</a>

Re: why we need both the collector & buffer process

From
Bruce Momjian
Date:
William.Jiang wrote:
> 
> hi,all hackers of postgres
> 
>     when postmaster start as a service . another two
>     processes(collector & buffer ) start their work at the same
>     time.
> 
>    I have read the code and I am wondering why we need two
>    processes to do the work. I think one process can work as
>    well. Are there something special you considered when you
>    developed this feature?

One collects statistics for the pg_stat tables, and the other does
checkpoints.  They are different functions.

-- Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: why we need both the collector & buffer process

From
Tom Lane
Date:
"William.Jiang" <jiang_sir@yahoo.com.cn> writes:
>    I have read the code and I am wondering why we need two processes to do the work. I think one process can work as
well.Are there something special you considered when you developed this feature?
 

It's a buffering issue.  Read the discussion in the pghackers archives
for details.
        regards, tom lane


Re: why we need both the collector & buffer process

From
"William.Jiang"
Date:
<p>Sorry to say that I cannot see which process is used to do checkpoints. I just see two main functions.
<p> pgstat_recvbuffer():this function is to receive the information from the postgres .this function is the main body
ofbuffer process <p>pgstat_min():this function is to do the job of  getting information from the buffer process and
writingthem to the file . and this is the main body of collector process. <p>Any function else to do the checkpoint
job?<p>Best Wishes! <p>William <p>   <b><i>Bruce Momjian <pgman@candle.pha.pa.us></i></b> wrote:<blockquote
style="BORDER-LEFT:#1010ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">William.Jiang wrote:<br />> <br />>
hi,allhackers of postgres<br />> <br />> when postmaster start as a service . another two<br />>
processes(collector& buffer ) start their work at the same<br />> time.<br />> <br />> I have read the
codeand I am wondering why we need two<br />> processes to do the work. I think one process can work as<br />>
well.Are there something special you considered when you<br />> developed this feature?<br /><br />One collects
statisticsfor the pg_stat tables, and the other does<br />checkpoints. They are different functions.<br /><br />--<br
/>BruceMomjian | http://candle.pha.pa.us<br />pgman@candle.pha.pa.us | (610) 359-1001<br />+ If your life is a hard
drive,| 13 Roberts Road<br />+ Christ can be your backup. | Newtown Square, Pennsylvania 19073</blockquote><p><br /><hr
size="1"/><b>Do You Yahoo!?</b><br /><a
href="http://rd.yahoo.com/mail_cn/tag/?http://ad.cn.doubleclick.net/clk;4983632;7740969;c?http://www.ibm.com/cn/promotion/optin/reg.shtml">"IBM优惠价特权,谁先来谁先得!"</a>