I have worked with MySQL and PHP project earlier for a iPhone app, but when storage data size increases with time, client moved with NodeJS and MongoDB.
我之前曾为MySQL应用程序使用MySQL和PHP项目,但是当存储数据大小随着时间的推移而增加时,客户端随着NodeJS和MongoDB而移动。
We have made a new version of app with Mongo database, which is working fine with few records.
我们用Mongo数据库创建了一个新版本的应用程序,它运行良好,记录很少。
But when we have migrated MySQL database into MongoDB, it has consumed almost 2GB space at server.
但是当我们将MySQL数据库迁移到MongoDB时,它在服务器上消耗了近2GB的空间。
Our app having large numbers of users and its related data.
我们的应用程序拥有大量用户及其相关数据。
And now we are stuck that find records (20 records) taking so much time (4 to 5 seconds) which leads to unwanted time consumption in the app, and users irritated in most of activities in app.
现在我们陷入困境,发现记录(20条记录)需要花费很多时间(4到5秒),导致应用程序中不必要的时间消耗,并且用户在应用程序的大多数活动中都会感到烦躁。
2 个解决方案
#1
2
Take a look at this section of the documentation MongoDB talking about Performance Optimization.
看一下MongoDB文档中关于性能优化的文档的这一部分。
As the documentation displayed options are:
由于文档显示选项是:
- Create Indexes to Support Queries
- Use Projections to Return Only Necessary Data
创建索引以支持查询
使用预测仅返回必要的数据
http://docs.mongodb.org/manual/tutorial/optimize-query-performance-with-indexes-and-projections/
#2
0
You probably need to add indexes to your collection.
您可能需要为集合添加索引。
ensureIndex
command creates an index on the collection. It will improve the speed of your queries significantly. The indexes will have to be created according to the queries you use.
ensureIndex命令在集合上创建索引。它将显着提高您的查询速度。必须根据您使用的查询创建索引。
Please follow this documentation:
http://docs.mongodb.org/manual/core/index-creation/
请遵循以下文档:http://docs.mongodb.org/manual/core/index-creation/
#1
2
Take a look at this section of the documentation MongoDB talking about Performance Optimization.
看一下MongoDB文档中关于性能优化的文档的这一部分。
As the documentation displayed options are:
由于文档显示选项是:
- Create Indexes to Support Queries
- Use Projections to Return Only Necessary Data
创建索引以支持查询
使用预测仅返回必要的数据
http://docs.mongodb.org/manual/tutorial/optimize-query-performance-with-indexes-and-projections/
#2
0
You probably need to add indexes to your collection.
您可能需要为集合添加索引。
ensureIndex
command creates an index on the collection. It will improve the speed of your queries significantly. The indexes will have to be created according to the queries you use.
ensureIndex命令在集合上创建索引。它将显着提高您的查询速度。必须根据您使用的查询创建索引。
Please follow this documentation:
http://docs.mongodb.org/manual/core/index-creation/
请遵循以下文档:http://docs.mongodb.org/manual/core/index-creation/