在android中多次访问数据库。性能怎么样?
在我的应用程序中,我经常从数据库中检索内容。因此,我可能会在需要时从数据库访问数据。例如,即使在一个活动中,我也会打开和关闭数据库 3 到 4 次。这是否足以导致性能下降?
In my application, I'm retrieving content from the database very often. So I'm likely to access data from database when it is required. For example, even within an activity I'll open and close the database 3 to 4 times. Is this enough to cause performance to suffer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上取决于您正在读取的数据量以及查询的复杂程度。就我个人而言,除非您能注意到性能问题,否则我不会担心为什么要修复不存在的问题。也就是说,如果您注意到性能问题并认为数据库可能是原因,您可以尝试以下操作:
This would really depend on the amount of data you are reading and how complicated the queries are. Personally I wouldn't worry about unless you can notice the performance issue, why fix a problem that doesn't exist. That said if you are noticing performance problems and think the database may be the cause you can try the following: