OffsetNumber, picksplit, and GiST

From: Itai Zukerman <zukerman(at)math-hat(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: OffsetNumber, picksplit, and GiST
Date: 2003-02-26 03:29:11
Message-ID: 87bs0z1zzs.fsf@matt.w80.math-hat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Is the GiST examples I've looked through, in the picksplit functions,
I see code that looks roughly like this:

bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
OffsetNumber i, maxoff;

maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 1;

for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
{
... DatumGetPointer((((GISTENTRY *) (VARDATA(entryvec)))[i].key)) ...
}

I'm wondering, since FirstOffsetNumber is 1, what about the 0'th index
in entryvec? Is it just not set?

Also, is there some rationalle for using OffsetNumber in
GIST_SPLITVEC? I see in off.h:

/*
* OffsetNumber:
*
* this is a 1-based index into the linp (ItemIdData) array in the
* header of each disk page.
*/

and I don't get the connection with what picksplit is doing (keeping
in mind that I don't know what "linp", "ItemIdData" or "disk page"
mean).

I have a very tenuous understanding of all this, so please bear with me.

--
Itai Zukerman <http://www.math-hat.com/~zukerman/>

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Itai Zukerman 2003-02-26 03:40:58 Re: Polymorphic?
Previous Message James Cooper 2003-02-26 03:09:40 performance