Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've a database collection in MongoDB having around 6 million rows. The collection has three common keys. One of which acts as an index (has user ids). The second one is a string. But the third one, is a multidimensional array.

For every record, the multidimensional array is stored as array in MongoDB. I've index setup in MongoDB properly. The problem I have been facing recently is crashing of MongoDB for some reason. The backup script might be the reason, which runs every day. But I need to have daily backups.

I've some other collections in the database too. What I've been thinking is to use MySQL for this single table. Would this save space ( since MongoDB uses key:value relationship )? If yes, which engine would be preferred for a table which has 6 million records, one index, one VARCHAR and a column with data serialize() ed with php?

On the table in MongoDB, around 10 queries per second (on average) are fired. The only query that would run on this table in MySQL,except the data dump queries for backups, is SELECT data FROM table where user = 'id'.

Also, I have memory limits. My server has 512 MB. It hosts an apache installation with 500-2000 pageviews daily. I've no problem boosting up the RAM, if it could promise stability.

share|improve this question
If you queries are going to be that simple, why not just setup a database in a testing environment and try it. Sure seems like it should be pretty easy to try. – Zoredache Aug 25 '11 at 4:58
But downloading the 3 GB mongodb database on local computer wouldn't be easy. – KPL Aug 25 '11 at 4:59
Easy or not was not the question. 6 Million rows is a piece of cake for any decent DBMS. – mailq Aug 25 '11 at 7:44

closed as too localized by womble, Shane Madden, Zoredache, EEAA, mailq Aug 25 '11 at 7:44

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

Mongodb does not work very well if it's not almost totally memory mapped and 512 megs sounds to low for 6 million records. Depending on your usage pattern you should use a memcached-like product in front of this table to exploit time locality of keys.

On the other side, why is the data type a multidimensional array in mongo and a string (serialized object) for mysql ?

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.