Re: Is it possible to create an index without keeping the indexed data in a column? - Mailing list pgsql-general

From David G Johnston
Subject Re: Is it possible to create an index without keeping the indexed data in a column?
Date
Msg-id 1406877281608-5813500.post@n5.nabble.com
Whole thread Raw
In response to Is it possible to create an index without keeping the indexed data in a column?  (Larry White <ljw1001@gmail.com>)
Responses Re: Re: Is it possible to create an index without keeping the indexed data in a column?  (Larry White <ljw1001@gmail.com>)
List pgsql-general
larrry wrote
> Hi,
>
> I would like to create a GIN index on a set of JSON documents. Right now
> I'm storing the data in a JSONB column. The current index looks like this:
>
> CREATE INDEX document_payload_idx
>   ON document
>   USING gin
>   (payload jsonb_path_ops);
>
> The index is pretty small, but the actual data takes up a *lot* of space.
> Is there a way to get Postgres to index the table *as if* the JSON were
> there, but not actually put the data in the table? I could either store
> the
> docs elsewhere and keep a reference, or compress them and put them in the
> table in compressed form as a blob.
>
> Thanks much for your help.
>
> Larry

No idea if this works but maybe you can store the compressed data and then
write the index expression like:

USING gin (unzip(payload) jsonb_path_ops)

The unzip function would need to be custom I think...

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Is-it-possible-to-create-an-index-without-keeping-the-indexed-data-in-a-column-tp5813461p5813500.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: David G Johnston
Date:
Subject: Re: Is it possible to create an index without keeping the indexed data in a column?
Next
From: Pujol Mathieu
Date:
Subject: Re: How to implement a uniqueness constraint across multiple tables?