MongoDB, Complex Queries, and Performance MongoDB, Complex Queries, and Performance sqlite sqlite

MongoDB, Complex Queries, and Performance


Try with a regular expression :

$regex = new MongoRegex('/^' . preg_quote('a day to remember'). '$/i');$query = array('artist' => $regex);$cursor = $collection->find($query);


You have to store a value twice if you want to do a case insensitive search on this value in Mongodb. Once normal and once in lowercase for indexing and searching.

Mongodb has a rich query language (compared to other nosql systems) and you can index every (combination) of columns. I do however find mapreduce to be slow, but as long you can solve your problem without mapreduce you are fine.


The different NoSQL solutions differ between each other much more than traditional SQL databases differ, but MongoDB is actually one of the most feature-rich of the lot, especially when it comes to query complexity.

However, you shouldn't blindly go for a NoSQL solution just because you are expecting 60,000 rows per user. MySQL, and the other popular relational DBMSes can handle billions of rows without problems.

Relational databases come with plenty of important features (ACID guarantees and complex queries for example), and if you need these features, you might as well use an SQL database. NoSQL is usually a trade-off between some of those features (or all of them), and ease of horizontal scalability. If you can expect to manage the scalability problem for your system using a relational DBMS, then I would seriously consider sticking to SQL.

I'm currently giving each user their own SQLite database to get around my provider's 1GB MySQL DB limit.

You could also consider switching providers. A host that applies such limits will probably limit you in some other way eventually.