questions about how to implement a gist index

Started by Riccardo Vianelloalmost 10 years ago3 messagesgeneral
Jump to latest
#1Riccardo Vianello
riccardo.vianello@gmail.com

Hi all,

I'm trying to contribute some improvements to the implementation of a gist
index that is part of an open source project and it would be really nice if
anyone could help me answer some questions.

I would like to use different data structures to represent the internal and
leaf entries. I think I have found several examples in the postgresql
source code where a variable length array is used to pack different data
consistently with the value of a "type" attribute. Is this the suggested
way to proceed, or would it be also possible to use two actually different
data structures? I at first considered this latter approach, but some
erroneous behavior suggested that maybe I am not fully clear about which
data structure should be produced or expected by some parts of the
implementation.

Could you please also help me understand the difference (if any) between
using the GIST_LEAF macro or the leafkey attribute of the GISTENTRY data
structure?

Thank you very much in advance,

Riccardo

#2Oleg Bartunov
oleg@sai.msu.su
In reply to: Riccardo Vianello (#1)
Re: questions about how to implement a gist index

On Tue, Jun 28, 2016 at 12:44 AM, Riccardo Vianello
<riccardo.vianello@gmail.com> wrote:

Hi all,

I'm trying to contribute some improvements to the implementation of a gist
index that is part of an open source project and it would be really nice if
anyone could help me answer some questions.

I would like to use different data structures to represent the internal and
leaf entries. I think I have found several examples in the postgresql source
code where a variable length array is used to pack different data
consistently with the value of a "type" attribute. Is this the suggested way
to proceed, or would it be also possible to use two actually different data
structures? I at first considered this latter approach, but some erroneous
behavior suggested that maybe I am not fully clear about which data
structure should be produced or expected by some parts of the
implementation.

Could you please also help me understand the difference (if any) between
using the GIST_LEAF macro or the leafkey attribute of the GISTENTRY data
structure?

Yes, this is confused.

GIST_LEAF is TRUE if key is in leaf page.

bool leafkey points if TRUE that key contains value from heap.

Thank you very much in advance,

Riccardo

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

#3Riccardo Vianello
riccardo.vianello@gmail.com
In reply to: Oleg Bartunov (#2)
Re: questions about how to implement a gist index

Hi Oleg,

On Tue, Jun 28, 2016 at 1:05 AM, Oleg Bartunov <obartunov@gmail.com> wrote:

On Tue, Jun 28, 2016 at 12:44 AM, Riccardo Vianello
<riccardo.vianello@gmail.com> wrote:

Could you please also help me understand the difference (if any) between
using the GIST_LEAF macro or the leafkey attribute of the GISTENTRY data
structure?

Yes, this is confused.

GIST_LEAF is TRUE if key is in leaf page.

bool leafkey points if TRUE that key contains value from heap.

I think I wrongly assumed that internal and leaf nodes are homogeneously
filled with union and indexed values respectively. Is it correct that
leafkey is always TRUE for the entries that populate a leaf page, and may
be either TRUE and FALSE if GIST_LEAF is FALSE?

Thanks,
Riccardo