What's the proper index for querying structures in arrays in Postgres jsonb?
I'm experimenting with keeping values like the following in a Postgres jsonb field in Postgres 9.4: [{"event_slug":"test_1","start_time":"2014-10-08","end_time":"2014-10-12"}, {"event_slug":"test_2","start_time":"2013-06-24","end_time":"2013-07-02"}, {"event_slug":"test_3","start_time":"2014-03-26","end_time":"2014-03-30"}] I'm executing queries like: SELECT * FROM locations WHERE EXISTS ( SELECT 1 FROM jsonb_array_elements(events) AS e WHERE ( e->>'event_slug' = 'test_1' AND ( e->>'start_time' >= '2014-10-30 14:04:06 -0400' OR e->>'end_time' >= '2014-10-30 14:04:06 -0400' ) ) ) How would I