Re: Function call hierarchy/path since getting the buffer until access its data

From: Waldecir Faria <fighter2929(at)hotmail(dot)com>
To: <robertmhaas(at)gmail(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function call hierarchy/path since getting the buffer until access its data
Date: 2012-05-30 13:37:26
Message-ID: SNT137-W594D6F2AAFC67F47C453D1AC0A0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Thank you for the reply Robert. I think I am getting the idea about reading buffers but I am confused about the writing part, can you give me a function name where it does some write operations like creating a table or inserting a tuple for me read as a example.

Best Regards ,
-Waldecir

> Date: Tue, 29 May 2012 11:33:59 -0400
> Subject: Re: [HACKERS] Function call hierarchy/path since getting the buffer until access its data
> From: robertmhaas(at)gmail(dot)com
> To: fighter2929(at)hotmail(dot)com
> CC: pgsql-hackers(at)postgresql(dot)org
>
> On Mon, May 28, 2012 at 8:15 AM, Waldecir Faria <fighter2929(at)hotmail(dot)com> wrote:
> > Good morning, I am doing a study about buffer management to improve the
> > performance of one program that does heavy I/O operations. After looking and
> > reading from different softwares' source codes/texts one friend suggested me
> > to take a look at the PostgreSQL code. I already took a look at the
> > PostgreSQL buffer management modules ( freelist.c and cia ) but now I am a
> > bit confused how the buffer read/write works, I tried to see how PostgreSQL
> > does to get, for example, a char array from one buffer. Looking at rawpage.c
> > I think that I found a good example using the following function calls
> > sequence starting at function get_raw_page_internal():
> >
> > StrategyGetBuffer->BufferAlloc->ReadBuffer_Common
> > ->ReadBufferExtended->BufferGetPage-> memcpy page to buf
>
> BufferGetPage() doesn't copy anything; it just takes the buffer number
> and returns a pointer to the address of that buffer in memory. More
> generally, that whole chain of function calls has to do with how a
> page ends up inside PostgreSQL's buffer cache, not with how anything
> on the page is actually decoded. Each buffer contains zero or more
> tuples; each tuple contains multiple attributes. So after you get the
> buffer you have to iterate over the tuples and then decode each tuple
> to get the values that you want.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc Mamin 2012-05-30 13:57:02 Re: How could we make it simple to access the log as a table?
Previous Message Merlin Moncure 2012-05-30 13:33:48 Re: hash index concurrency