It seems like https://github.com/nviennot/nobrainer/blob/master/lib/no_brainer/criteria/where.rb#L393 prevents compound indexes from being used unless the query has equality arguments for all fields in the index. I can see why you might want to avoid supporting partial indexes in general, as the logic to select the best of several different indexes could get insanely complex, but it doesn't seem like much of a stretch to use compound indexes when one of the fields uses an inequality.
In any event, can you suggest a workaround to support this case? Thanks ...
I have a
user_items
table with a compound index on[:user_id, :item_id]
. I'm trying to do a range query, but I can't get NoBrainer to use the index:... when what I want is ...
It seems like https://github.com/nviennot/nobrainer/blob/master/lib/no_brainer/criteria/where.rb#L393 prevents compound indexes from being used unless the query has equality arguments for all fields in the index. I can see why you might want to avoid supporting partial indexes in general, as the logic to select the best of several different indexes could get insanely complex, but it doesn't seem like much of a stretch to use compound indexes when one of the fields uses an inequality.
In any event, can you suggest a workaround to support this case? Thanks ...