Re: Computed index on transformation of jsonb key set

2019-05-06 Thread Steven Schlansker
> On Apr 27, 2019, at 12:55 AM, Andrew Gierth > wrote: > > Obvious solution: > > create function uuid_keys(mapData jsonb) returns uuid[] > language plpgsql immutable strict > as $$ >begin > return array(select jsonb_object_keys(mapData)::uuid); >end; > $$; > > create index on

Re: Computed index on transformation of jsonb key set

2019-04-27 Thread Andrew Gierth
> "Steven" == Steven Schlansker writes: Steven> I figured I'd end up with significantly better storage and Steven> performance characteristics if I first compute a uuid[] value Steven> and build the GIN over that, and use the array operator class Steven> instead. Additionally, this elimin

Re: Computed index on transformation of jsonb key set

2019-04-26 Thread Rob Sargent
On 4/26/19 3:53 PM, Steven Schlansker wrote: On Apr 26, 2019, at 2:33 PM, Rob Sargent wrote: On 4/26/19 3:25 PM, Steven Schlansker wrote: How can I efficiently implement the feature I've described? It seems difficult to use computed indexing with GIN. Storing the map in a child table

Re: Computed index on transformation of jsonb key set

2019-04-26 Thread Steven Schlansker
> On Apr 26, 2019, at 2:33 PM, Rob Sargent wrote: > > > On 4/26/19 3:25 PM, Steven Schlansker wrote: >> >> >> How can I efficiently implement the feature I've described? It seems >> difficult to use computed indexing with GIN. >> > Storing the map in a child table (parentId, UUID, int) i

Re: Computed index on transformation of jsonb key set

2019-04-26 Thread Rob Sargent
On 4/26/19 3:25 PM, Steven Schlansker wrote: Hi Postgres fans, We store a Java Map in Postgres as a jsonb column. As json does not have a UUID type, it is of course stored as text. A simple value might be: {"04e623c0-6940-542f-a0de-4c999c626dfe": 5000, "6d3e24b6-9e8c-5eb1-9e4c-f32cc40864

Re: Computed index on transformation of jsonb key set

2019-04-26 Thread David G. Johnston
On Fri, Apr 26, 2019 at 2:25 PM Steven Schlansker < stevenschlans...@gmail.com> wrote: > How can I efficiently implement the feature I've described? It seems > difficult to use computed indexing with GIN. > Don't use a computed index? Add a trigger to populate a physical column and index that.