Re: JSON vs Text + Regexp Index Searching

From: Eliot Gable <egable+pgsql-general(at)gmail(dot)com>
To: Eliot Gable <egable+pgsql-general(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: JSON vs Text + Regexp Index Searching
Date: 2014-02-25 20:34:39
Message-ID: CAD-6L_Uzx3db=PBnNCo7H4C=emPkTtFbQOSAJQvrLnc9eCFhig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Feb 25, 2014 at 3:13 PM, Eliot Gable <egable+pgsql-general(at)gmail(dot)com
> wrote:

> On Tue, Feb 25, 2014 at 11:17 AM, David Johnston <polobo(at)yahoo(dot)com> wrote:
>
>> David Johnston wrote
>> >
>> > Eliot Gable-4 wrote
>> >> I advocated creating a separate mapping table which
>> >> maps the ID of these records to the other ID we are searching for and
>> >> performing a JOIN on the two tables with appropriate foreign key
>> >> relationships and indices. However, I was ask to instead put the list
>> >> into
>> >> a single column on each row to reduce implementation complexity.
>> >>
>> >> Assuming the list of IDs is in a column on each row as TEXT in the
>> format
>> >> of a JSON array, what is the best way to index the column so I can
>> >> quickly
>> >> find the rows with the given ID?
>> > I recommend benchmarking two implementations:
>> >
>> > 1) id_xref integer[] --on the same table, use "search_id = ANY(id_xref)"
>> > as the WHERE condition
>> >
>> > [...]
>>
>> #1 can be greatly expanded in usefulness by making use of the "intarray"
>> contrib/extension; as Merlin mentioned up-thread.
>>
>> David J.
>>
>>
>
> Thank you both for the responses. I will benchmark the options you
> suggested.
>
>

Is there some way to make intarray work with int8 or some int8 variation of
intarray? The data type of the IDs is BIGINT.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message john.tiger 2014-02-25 21:43:21 Josh's Comments on Hstore / Jsonb
Previous Message Eliot Gable 2014-02-25 20:13:25 Re: JSON vs Text + Regexp Index Searching