Re: compress method for spgist - 2

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: compress method for spgist - 2
Date: 2014-12-23 09:48:38
Message-ID: 54993A76.7050308@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/16/2014 07:48 PM, Teodor Sigaev wrote:
> /*
> * This struct is what we actually keep in index->rd_amcache. It includes
> * static configuration information as well as the lastUsedPages cache.
> */
> typedef struct SpGistCache
> {
> spgConfigOut config; /* filled in by opclass config method */
>
> SpGistTypeDesc attType; /* type of input data and leaf values */
> SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */
> SpGistTypeDesc attLabelType; /* type of node label values */
>
> SpGistLUPCache lastUsedPages; /* local storage of last-used info */
> } SpGistCache;

Now that the input data type and leaf data type can be different, which
one is "attType"? It's the leaf data type, as the patch stands. I
renamed that to attLeafType, and went fixing all the references to it.
In most places it's just a matter of search & replace, but what about
the reconstructed datum? In freeScanStackEntry, we assume that
att[Leaf]Type is the datatype for reconstructedValue, but I believe
assume elsewhere that reconstructedValue is of the same data type as the
input. At least if the opclass supports index-only scans.

I think we'll need a separate SpGistTypeDesc for the input type. Or
perhaps a separate SpGistTypeDesc for the reconstructed value and an
optional decompress method to turn the reconstructedValue back into an
actual reconstructed input datum. Or something like that.

Attached is a patch with the kibitzing I did so far.

- Heikki

Attachment Content-Type Size
spgist_compress_method-4-heikki.patch text/x-diff 13.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-12-23 10:28:42 Re: PATCH: adaptive ndistinct estimator v3 (WAS: Re: [PERFORM] Yet another abort-early plan disaster on 9.3)
Previous Message Atri Sharma 2014-12-23 09:40:21 Re: mysql with postgres