From: | Greg Smith <greg(at)2ndquadrant(dot)com> |
---|---|
To: | sunpeng <bluevaley(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org, noue(at)tpf(dot)co(dot)jp |
Subject: | Re: where are the getting buf data from disk really done? |
Date: | 2010-04-20 02:06:32 |
Message-ID: | 4BCD0C28.2010102@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
sunpeng wrote:
>
> I noticed at the function StartBufferIO() in bufmgr.c, there is no
> really getting buffer data from disk, only set InProgressBuf = buf;
> and return true;
> i wondered where is the getting buf data from disk really done?
> are there a background process to do this work? which function does
> this work?
That's done by ReadBuffer_common in that same bit of source code. The
call to smgrread is the one that does the read from disk. StartBufferIO
is actually part of the buffer allocation code, used to lock things so
that only one backend tries to read in a buffer that more than one might
want. Some highlights of the main code path here:
ReadBuffer | ReadBufferExtended | ReadBufferWithoutRelcache
ReadBuffer_common
BufferAlloc
StrategyGetBuffer
StartBufferIO
smgrread
There is no background process involved at any point here. The only
background process related to the buffer cache in the current PostgreSQL
implementation alternates between writing out checkpoint data and
writing dirty buffers that haven't been used recently, in hopes of
speeding up the BufferAlloc section here. Everything else is done
directly by the client backends.
--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2010-04-20 02:51:16 | Re: Int64GetDatum |
Previous Message | Tom Lane | 2010-04-20 01:59:25 | Re: where are the getting buf data from disk really done? |