orion3
orion3

Reputation: 9945

Indexing in mongoid: when and how often should I run rake db:mongoid:create_indexes?

It's not quite clear from the documentation: when and how often should I run rake db:mongoid:create_indexes. Let's say I added some indexes macro to the models already and am never going to add new ones in the future. Does that mean I may run the rake task just once or should I be running it, say, once a day?

Upvotes: 6

Views: 1245

Answers (1)

Andz
Andz

Reputation: 2258

You should run the task once.

After the indexes have been created, you don't need to run the command anymore as the indexes already exist and don't need to be added again.

Of course, if you create new indexes, you'll need to run the command to add the new indexes to mongodb.

Upvotes: 9

Related Questions