-
Couldn't load subscription status.
- Fork 71
Open
Labels
Description
Hi!
I am using v2.1.8 and polymorphic indexes are still suggested despite them already being present in different order, see #107
Furthermore, I believe the suggestion should be in the format [:poly_type, :poly_id]. This is somewhat of a controversial topic, but the reasoning for putting the type first is that it is more useful:
Pros:
- Index can be used for searches only by type (in case we want a count of how many records by types there are)
Cons:
- Index can not be used to search by just
:poly_id, but this should be a non-problem since it can be argued that searching by just polymorphic ID does not guarantee that the correct record is selected.
Additionally, there are false positives when using Rails' STI pattern. If a table has a :type column loldba proposes an [:id, :type] index, which is redundant, especially if an index on just :type is present (and :id is indexed by default).
AhmedKamal20 and darwintantuco