Quoting Marnen Laibow-Koser <li...@ruby-forum.com>: > Jeffrey L. Taylor wrote in post #959191: > > Quoting Marnen Laibow-Koser <li...@ruby-forum.com>: > >> Jeffrey L. Taylor wrote in post #958953: > >> > How should I index the terms table for maximum speed? > >> > >> How can we tell you? You neglected to say how you're using that > >> table...or is the query below the only one you're interested in? > >> > > > > Correct, this is the one I care about. All others are trivial in terms > > of > > resources compared to this one. > > > >> > It doesn't have > >> > to be > >> > Rails migration doable. > >> > >> But it will be, since adding indices generally is. > >> > > > > Composite keys are not supported in stock Rails. > > Composite *primary keys* are not (but there's a plugin). Composite > *indices* are. You can specify multiple columns in add_index. >
Sorry I left out a constraint that turned out to be critical. This is the primary and only index on this table. I've tried the plug-in. It was not reliable in my use scenario. > > > And I will not switch > > DB > > servers next week, so having the index creation in portable form is not > > a necessity. > > Never write SQL in Rails unless there's no other way. > If it is feasible in Rails, I do it that way. However, I was explicitly lifting the constraint of doable in Rails for this usecase. If the usecase included dozens of servers and multiple DB server software, then staying in Rails would make sense. I have one production server (with test database) and one or two development setups (with test databases). Setup in the database client program is very doable. Fighting to shoehorn a usecase that Rails does not handle into Rails is not productive. Jeffrey -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.