Moving 'hot' pages from buffer pool to heap

Started by Atri Sharmaover 12 years ago7 messages
#1Atri Sharma
atri.jiit@gmail.com

Hi all,

I was experimenting with the idea of moving hot buffer pages from the
buffer pool to heap, thus allowing for normal removal of the hot
buffer page from the buffer pool and freeing the corresponding buffer
pool slot.

This shouldnt be too hard to implement, we just need to keep track of
the number of times a page was accessed(or the duration of pins held,
I am not sure).

The point is to not hold a buffer pool slot for more than a fixed
duration of time, to ensure constant flow in the buffer pool.

Has there been discussion about it done previously? I couldnt find an
existing implementation, nor a discussion for the same. If I missed
anything, please point me to it.

Please let me know your feedback and comments.

Thanks and Regards,

Atri

--
Regards,

Atri
l'apprenant

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Atri Sharma (#1)
Re: Moving 'hot' pages from buffer pool to heap

Atri Sharma <atri.jiit@gmail.com> writes:

I was experimenting with the idea of moving hot buffer pages from the
buffer pool to heap, thus allowing for normal removal of the hot
buffer page from the buffer pool and freeing the corresponding buffer
pool slot.

Uh ... what? Why in the world would you want to force a hot page out of
shared buffers? I fail to conceive of any scenario where that'd be a
good idea.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Jeff Janes
jeff.janes@gmail.com
In reply to: Atri Sharma (#1)
Re: Moving 'hot' pages from buffer pool to heap

On Mon, Aug 5, 2013 at 12:36 PM, Atri Sharma <atri.jiit@gmail.com> wrote:

Hi all,

I was experimenting with the idea of moving hot buffer pages from the
buffer pool to heap,

Which heap do you mean here? Alas, half the data structures used in CS
are called "heap". I can't think of any of them that are good
candidates for this, though.

Cheers,

Jeff

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Atri Sharma
atri.jiit@gmail.com
In reply to: Tom Lane (#2)
Re: Moving 'hot' pages from buffer pool to heap

Sent from my iPad

On 06-Aug-2013, at 1:14, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Atri Sharma <atri.jiit@gmail.com> writes:

I was experimenting with the idea of moving hot buffer pages from the
buffer pool to heap, thus allowing for normal removal of the hot
buffer page from the buffer pool and freeing the corresponding buffer
pool slot.

Uh ... what? Why in the world would you want to force a hot page out of
shared buffers? I fail to conceive of any scenario where that'd be a
good idea.

Just experimenting though.I was thinking of scenarios where a page is pinned for long period of time.My concern was that it would lead to blocking of a buffer pool slot for that entire duration. The idea is to allocate a separate data structure for such hot pages in memory,and maintain them there.

Sorry if it is naive though.

Regards,

Atri

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Atri Sharma
atri.jiit@gmail.com
In reply to: Jeff Janes (#3)
Re: Moving 'hot' pages from buffer pool to heap

Sent from my iPad

On 06-Aug-2013, at 1:24, Jeff Janes <jeff.janes@gmail.com> wrote:

On Mon, Aug 5, 2013 at 12:36 PM, Atri Sharma <atri.jiit@gmail.com> wrote:

Hi all,

I was experimenting with the idea of moving hot buffer pages from the
buffer pool to heap,

Which heap do you mean here? Alas, half the data structures used in CS
are called "heap". I can't think of any of them that are good
candidates for this, though.

My bad.By heap, I meant the memory.The idea is to allocate a new slot in memory for holding that page,so as to free the buffer pool slot.

Regards,

Atri

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Atri Sharma (#4)
Re: Moving 'hot' pages from buffer pool to heap

Atri Sharma <atri.jiit@gmail.com> writes:

Just experimenting though.I was thinking of scenarios where a page is pinned for long period of time.My concern was that it would lead to blocking of a buffer pool slot for that entire duration. The idea is to allocate a separate data structure for such hot pages in memory,and maintain them there.

You can't do that; such a copy could easily become stale, leading to wrong
query answers. Perhaps more to the point, long-term pins (as opposed to
locks) aren't that problematic. What problem do you think you're solving?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#7Atri Sharma
atri.jiit@gmail.com
In reply to: Tom Lane (#6)
Re: Moving 'hot' pages from buffer pool to heap

Sent from my iPad

On 06-Aug-2013, at 1:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Atri Sharma <atri.jiit@gmail.com> writes:

Just experimenting though.I was thinking of scenarios where a page is pinned for long period of time.My concern was that it would lead to blocking of a buffer pool slot for that entire duration. The idea is to allocate a separate data structure for such hot pages in memory,and maintain them there.

You can't do that; such a copy could easily become stale, leading to wrong
query answers. Perhaps more to the point, long-term pins (as opposed to
locks) aren't that problematic. What problem do you think you're solving?

Yeah,long term pins are something I was thinking of solving with this.Now that you mention it, I think my main concern wasn't long term pins,rather,anything that doesn't allow for page eviction for a long time.

Regards,

Atri

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers