Thread: Misunderstanding on the FSM README file

Misunderstanding on the FSM README file

From
Guillaume Lelarge
Date:
Hi,

I've been reading the FSM README file lately (src/backend/storage/freespace/README), and I'm puzzled by one of the graph (the binary tree structure of an FSM file). Here it is:

    4  
 4     2  
3 4   0 2    <- This level represents heap pages

Shouldn't the last line be:
4 3   2 0

(ie, highest number of free space on the left node, lowest on the right one)

Probably just nitpicking, but still, I'm wondering if I missed something out.

Thanks.

Re: Misunderstanding on the FSM README file

From
Heikki Linnakangas
Date:
On 12/07/2014 02:03 PM, Guillaume Lelarge wrote:
> Hi,
>
> I've been reading the FSM README file lately
> (src/backend/storage/freespace/README), and I'm puzzled by one of the graph
> (the binary tree structure of an FSM file). Here it is:
>
>      4
>   4     2
> 3 4   0 2    <- This level represents heap pages
>
> Shouldn't the last line be:
> 4 3   2 0
>
> (ie, highest number of free space on the left node, lowest on the right one)
>
> Probably just nitpicking, but still, I'm wondering if I missed something
> out.

No, that's not how it works. Each number at the bottom level corresponds 
to a particular heap page. The first number would be heap page #0 (which 
has 3 units of free space), the second heap page #1 (with 4 units of 
free space) and so forth. Each node on the upper levels stores the 
maximum of its two children.

- Heikki




Re: Misunderstanding on the FSM README file

From
Guillaume Lelarge
Date:
2014-12-07 15:07 GMT+01:00 Heikki Linnakangas <hlinnakangas@vmware.com>:
On 12/07/2014 02:03 PM, Guillaume Lelarge wrote:
Hi,

I've been reading the FSM README file lately
(src/backend/storage/freespace/README), and I'm puzzled by one of the graph
(the binary tree structure of an FSM file). Here it is:

     4
  4     2
3 4   0 2    <- This level represents heap pages

Shouldn't the last line be:
4 3   2 0

(ie, highest number of free space on the left node, lowest on the right one)

Probably just nitpicking, but still, I'm wondering if I missed something
out.

No, that's not how it works. Each number at the bottom level corresponds to a particular heap page. The first number would be heap page #0 (which has 3 units of free space), the second heap page #1 (with 4 units of free space) and so forth. Each node on the upper levels stores the maximum of its two children.


Oh OK. Thanks Heikki, that makes perfect sense.


--