watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

Postgres store: Use array operators instead of ANY() on links #214

Open gburgett opened 4 years ago

gburgett commented 4 years ago

Joining entries using the ANY(t.links) column actually makes it impossible to use an index to do that join, as explained in this Stack Overflow: https://stackoverflow.com/a/29245753/2192243

Instead of using ANY, we need to use the Array Contains operator @> and then apply a GIN index to the links column:

CREATE INDEX IF NOT EXISTS contentful_raw_links ON contentful_raw USING GIN (links array_ops);