Re: Partial index on JSON column - Mailing list pgsql-general

From Michael Lewis
Subject Re: Partial index on JSON column
Date
Msg-id CAHOFxGqsy8XqRsFC8z_uFuSKbpuJUfgaXigFXELU6it6pweT5A@mail.gmail.com
Whole thread Raw
In response to Partial index on JSON column  (Samuel Williams <space.ship.traveller@gmail.com>)
List pgsql-general

On Tue, Feb 19, 2019 at 1:41 PM Samuel Williams <space.ship.traveller@gmail.com> wrote:
Hello

I have a table with ~3 billion events.

Of this, there are a small subset of events which match the following query:

CREATE INDEX index_user_event_for_suggestion_notification ON public.user_event USING btree ((((parameters ->> 'suggestion_id'::text))::integer), what) WHERE ((parameters ->> 'suggestion_id'::text) IS NOT NULL)

You may want to use this-
CREATE INDEX index_user_event_for_suggestion_notification ON public.user_event USING btree (parameters ->> 'suggestion_id', what) WHERE parameters ? 'suggestion_id';


-Michael 

pgsql-general by date:

Previous
From: Samuel Williams
Date:
Subject: Re: Partial index on JSON column
Next
From: Michael Lewis
Date:
Subject: Re: Partial index on JSON column