Re: compress method for spgist - 2

Heikki Linnakangas <hlinnakangas@vmware.com>

From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Teodor Sigaev <teodor@sigaev.ru>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2014-12-23T09:48:38Z
Lists: pgsql-hackers

Attachments

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

Commits

  1. Doc: remove duplicate poly_ops row from SP-GiST opclass table.

  2. Add polygon opclass for SP-GiST