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

From Larry White
Subject Re: Re: Is it possible to create an index without keeping the indexed data in a column?
Date
Msg-id CAMdbzVj_ws1kKWnYQK3OuAhyGMHdNnBAEMX1VYJ8eWqQt+iY_A@mail.gmail.com
Whole thread Raw
In response to Re: Is it possible to create an index without keeping the indexed data in a column?  (David G Johnston <david.g.johnston@gmail.com>)
List pgsql-general
Thank you David and Amit. This is more or less what I was looking for. 

I _think_ I might be able to store the data as TEXT, which is highly compressed by Toast, and then perhaps write the function in terms of a TEXT to JSONB conversion.  I will give it a try. It might perform terribly, but will be an interesting experiment.:)


On Fri, Aug 1, 2014 at 3:14 AM, David G Johnston <david.g.johnston@gmail.com> wrote:
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.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Larry White
Date:
Subject: Re: Very Limited Toast Compression on JSONB (9.4 beta 2)
Next
From: Chris Travers
Date:
Subject: Feature proposal and discussion: full-fledged column/function equivalence