On Tue, Feb 19, 2019 at 1:41 PM Samuel Williams <space.ship.traveller@xxxxxxxxx> wrote:
HelloI 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