Re: GIST and TOAST

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: andrew(at)supernews(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: GIST and TOAST
Date: 2007-03-06 16:43:54
Message-ID: 45ED9A4A.2090404@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> So when does index_form_tuple get called?

The single call of index_form_tuple in GiST core is in gistFormTuple which
initially compress any indexed value with a help of their compress methods.

Only tuples formed by gistFormTuple could be inserted in index.

> Does every data type define a compress/decompress method? Even if it's not a
> data type that normally gets very large?

Yes, any GiST opclass should have such methods. In trivial case it just returns
input value. As I remember, only R-Tree emulation over boxes, contrib/seg and
contrib/cube have simple compress method.

> Well we cheated a bit and had heap/index_form_tuple convert the data to packed
> format. This saves having to push small tuples through the toaster. So now
> tuples can magically become toasted as soon as they go into a tuple even if
> they never get pushed through the toaster.
Ok, it should be safe for GiST except some possible memory management issue.
index_form_tuple in GiST works in GiST's memory context which is short-live. Is
it possible issue for your patch? BTW, that's connected to GIN too.

> So it's perfectly safe to just use DatumGetType and PG_GETARG_TYPE instead of
> using DatumGetPointer and PG_GETARG_POINTER and having to manually cast
> everywhere, no? It seems like there's a lot of extra pain to maintain the code
> in the present style with all the manual casts.
Of course, I agree. Just PG_FREE_IF_COPY is extra call in support methods.

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2007-03-06 16:48:41 Re: GIST and TOAST
Previous Message Josh Berkus 2007-03-06 16:43:25 Re: Synchronized Scan update