I faced small problem how to duplicate entire MongoDB database and I tried just to rename folder under data directory. So, instead of having my_database I just renamed it to my_new_database but it didn’t helped and when I used show collections it returned me an empty set.
I also tried to rename files inside data/my_database to my_new_database but this didn’t helped me either.
So, I finally looked into the documentation and found this command which copies the entire database:
db.copyDatabase("my_database", "my_new_database", "localhost")
We are using both databases for our projects and we can finalize some thoughts on both of them…
- Free – official website is here and you can download it here
- Because it is using NoSQL concept it is really extremely fast when it comes to the inserts into database. It is almost fast as writing directly into the disk. It is at least 10 times faster when doing inserts.
- Because is is using NoSQL there is no scheme, you just store your object into database (JSON serialization is done automatically) and when you later add some fields into your business object you don’t need to update scheme for table, just instert it and DB will take care of everything
- It is not user friendly when it comes to writing more complex queries especially for grouping especially when you figure our that standard group option is limited and for returning more then 20,000 records you need to use map-reduce
- When it comes to complex reading, especially grouping it is much slower when this operation need to be done on large group of records. If number of records is small it is still faster then MS SQL.
- Disk consumption will remain unchanged, even when you delete some records so you will need to do manually optimization to reduce the database size – it can be long operation
- The more memory you have and tha faster HDD you have (SSD is recommended – this expensive Intel 700 server series) it will work better because it tries to keep all indexes in memory and if number of records is big and you have more then one index then the size of these indexes will grow. We are talking here about maximum RAM capabilities you are able to put into the server.
- Still there is some issue with a thrust and questions “Is your data safe?”, “What happen when it crash?”
- Desinged for easy sharding
MS SQL Facts
- Expensive when compared to free MongoDB, also there is a complicated system of Microsoft licensing (per CPU core)
- Slower inserts because or relational structure
- Every table should be designed first, all columns need to have type defined and every change of your business object need that also database need to be changed (not 100% true, but almost)
- It is very user friendly when it comes to writing SQL queries and joins and very fast (compared to Mongo) when it comes to grouping on a large tables
- More easy to lookup your data using nice GUI such as MS SQL Server Managament Studio
Do you need some help in implementing your database model?
We have 15 years of experience and if you need any help please contact us.