![]() ![]() Retrieve the contents of one database page (the actual binary json document).One index lookup on the collection (assuming the entity is fetched by id).In MongoDB, to retrieve the whole entity, you have to perform: This is where MongoDB starts enabling superior performance. ![]() In MongoDB you can store this as a single document, in a single collection. If all of those related tables are subordinate to the main table (and they often are), then you might be able to model the data such that the entire entity is stored in a single document. Now consider the same design with a document store. This could easily use dozens of tables in MySQL (or any relational db) to store the data in normal form, with many indexes needed to ensure relational integrity between tables. People are seeing real world MongoDB performance largely because MongoDB allows you to query in a different manner that is more sensible to your workload.įor example, consider a design that persisted a lot of information about a complicated entity in a normalised fashion. After all, MySQL and MongoDB are both GPL, so if Mongo had some magically better IO code in it, then the MySQL team could just incorporate it into their codebase. If you store the same data, organised in basically the same fashion, and access it exactly the same way, then you really shouldn't expect your results to be wildly different. While ($row = mysql_fetch_array($result) ) Sample Code For Testing MySQL executeSQL($sql) $time_taken = $time_taken + ($time_end - $time_start) Sample Code Used For Testing MongoDB swalif I have 20 partitions on MySQL each of 1 million records.I have dual core + ( 2 threads ) i7 cpu and 4GB ram. ![]() Is there something I am doing wrong? I know that my tests are not perfect but is MySQL on par with MongoDb when it comes to read intensive chores. I ran the query about 1,000 times each for mysql and MongoDB and I am suprised that I do not notice a lot of difference in speed. I wanted to compare speed with MongoDB and I ran a test which would get and print 15 records randomly from our huge databases. I had a table called posts in MySQL with about 20 million records indexed only on a field called 'id'. I have been very excited about MongoDb and have been testing it lately. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |