MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Surendra Singhi Date:September 20 2006 3:24pm
Subject: multicolumn indexes, yes or no
View as plain text  

 I have 4-5 different types of models which can be tagged. So, in the taggings
table should I declare a multicolumn index on [taggable_type, taggable_id] or
a single column index on [taggable_id]. What are the pros and cons of either,
and which one is preferred?

If multicolumn, then in what order, i.e.,  [taggable_type, taggable_id] or
should it be [taggable_id, taggable_type]?

I have another table for tracking views for different objects, and this time
there are 3 columns [viewable_type, viewable_id, user_id], so should this one
be a 3 column index? 

Please suggest something. Thanks in advance.

Surendra Singhi,
Read my blog at:
| Great wits are sure to madness near allied,
| And thin partitions do their bounds divide.
|     (John Dryden, Absalom and Achitophel, 1681)

multicolumn indexes, yes or noSurendra Singhi20 Sep
  • Re: multicolumn indexes, yes or noDan Buettner20 Sep
  • Re: multicolumn indexes, yes or noSurendra Singhi21 Sep