GIN indexes do not work with any jsonb operators EXCEPT ? ?& ?| @>
. Clearly, your use of comparison operators >=
and <=
are not on that list. And all of those operators that it could help are also not on the list (meaning the index won't do anything) afaik.
That means needing indexed comparison operators, you'll need a btree.
CREATE INDEX ON public.influencers ((ig->'follower_count'));
All of that said, I think this is silly. Just normalize and put follower_count
as a proper column on the actual table and enjoy the performance benefits.