Thread: Moving 'hot' pages from buffer pool to heap

Moving 'hot' pages from buffer pool to heap

From
Atri Sharma
Date:
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



Re: Moving 'hot' pages from buffer pool to heap

From
Tom Lane
Date:
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



Re: Moving 'hot' pages from buffer pool to heap

From
Jeff Janes
Date:
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



Re: Moving 'hot' pages from buffer pool to heap

From
Atri Sharma
Date:

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
thatit would lead to blocking of a buffer pool slot for that entire duration. The idea is to allocate a separate data
structurefor such hot pages in memory,and maintain them there. 

Sorry if it is naive though.

Regards,

Atri


Re: Moving 'hot' pages from buffer pool to heap

From
Atri Sharma
Date:

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
bufferpool slot. 

Regards,

Atri


Re: Moving 'hot' pages from buffer pool to heap

From
Tom Lane
Date:
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
thatit would lead to blocking of a buffer pool slot for that entire duration. The idea is to allocate a separate data
structurefor 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



Re: Moving 'hot' pages from buffer pool to heap

From
Atri Sharma
Date:

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
thatit would lead to blocking of a buffer pool slot for that entire duration. The idea is to allocate a separate data
structurefor 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'tlong term pins,rather,anything that doesn't allow for page eviction for a long time. 

Regards,

Atri