This article shows how PostgreSQL, equipped with both GIN indexes and the cost-based optimizer (CBO), can automatically choose the most optimal query method.
Talking about PostgreSQL performance issues, I would like to add one more possible solution for locating bottlenecks and tunning the performance of slow queries - the visual PostgreSQL query analyzer can help you in solving all the mentioned issues https://www.devart.com/dbforge/postgresql/studio/