Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I increase the maximum number of indexes per collection in mongodb?

I have a collection that has different query params to support,as such I create indexes for every keys. I just added a few more and get an error:

pymongo.errors.OperationFailure: add index fails, too many indexes for collection key:{ foo: 1 }

and then I notice that the maximum number of indexes per collection in mongodb is just 64, Can I change this number ?

like image 806
Yohn Avatar asked Oct 16 '13 08:10

Yohn


People also ask

How many indexes can be created on a collection in MongoDB?

A collection cannot have more than 64 indexes. The length of the index name cannot be longer than 125 characters. A compound index can have maximum 31 fields indexed.

How many text indexes can a MongoDB collection have?

A collection can have at most one text index.

What is the maximum size of index key limit and number of indexes per collection?

The total size of an index entry, which can include structural overhead depending on the BSON type, must be less than 1024 bytes. A single collection can have no more than 64 indexes.

Can MongoDB have multiple indexes?

MongoDB can use the intersection of multiple indexes to fulfill queries. In general, each index intersection involves two indexes; however, MongoDB can employ multiple/nested index intersections to resolve a query.


1 Answers

The max is built into MongoDB:

http://docs.mongodb.org/manual/reference/limits/

Number of Indexes per Collection

A single collection can have no more than 64 indexes.

like image 89
Samuel Neff Avatar answered Nov 15 '22 03:11

Samuel Neff