pg_search: :associated_against queries don't use indexes

Hi fellows,

I’ve created a couple of gin indexes to speed up my pg_search scopes. All works fine and the generated queries use the indexes if I do simple against (Ex. :against => :load_number,).

But as soon as I add :associated_against indexes don’t get used anymore (or at least this is what postgres explain shows)

I do have indexes on the table/column that show in :associated_against

Any ideas what is going on here?

Regards,

About this issue

  • Original URL
  • State: open
  • Created 12 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

I’m all for a solution that is indexable and that returns roughly the same set of records. I’m personally not too concerned about the relative ranking of results, as I feel like the current solution’s ranking is fairly arbitrary.

There has also been some discussion about extracting associated_against into a separate gem to reduce complexity. Might be something worth exploring as well.