Index on a range array

From: Daniel Cristian Cruz <danielcristian(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Index on a range array
Date: 2013-08-13 20:47:52
Message-ID: CACffM9HGyvh0OqwS7KbMLJ+zZ3t_gOmZTB-C2WpLdWu45JZwQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,

I'm trying to simplify a schema, where I had many ranges floating around.
My idea is to put them all in an array field and query like this:

SELECT
event.*
FROM event
JOIN participant_details
USING (participant_id)
WHERE
tsrange(event.start, event.end) && ANY (participant_details.periods);

periods is tsrange[].

I've tryed and it worked, but without indexes. I've tried something, but
didn't found anything... Does someone know how to index this kind of field
(tsrange[])?

From the docs I learn that there is some GIST magic, but I would need to
code in C. Is that true?

Regards,
--
Daniel Cristian Cruz
クルズ クリスチアン ダニエル

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2013-08-13 21:01:26 Re: subselect requires offset 0 for good performance.
Previous Message Pavel Stehule 2013-08-12 15:24:17 Re: Function execute slow down in 9.2