CouchDB查询性能 [英] CouchDB query performance

查看:277
本文介绍了CouchDB查询性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果文档数更多,CouchDB中的数据查询会变慢吗?

If the number of documents is more will the querying of data gets slower in CouchDB?

示例场景:


  • 我有一个用于显示客户姓名的组合框。当用户键入客户名称时,我必须进行自动填充。

  • CouchDB中大约有1万个客户文档。我知道我必须创建一个视图来执行相同的操作。

  • CouchDB数据库位于应用程序所在的本地计算机中。

问题:
向数据库查询匹配的客户名是否需要超过2-3秒?
如果CouchDB中有很多文档(例如大约100000个文档),查询将为每个查询花费更多时间吗?

Question: Will it take more than 2 - 3 seconds to query the DB for matching customer names? Will querying take more time for each query if there are many documents in the CouchDB (say around 100000 documents)?

关于如何创建视图/的任何指针/索引会有所帮助。

Any pointers on how to create views/index will be helpful.

预先感谢。

推荐答案

视图在每个文档上运行,但只能运行一次。之后,文档的视图值将被永久存储。按名称获取客户的速度非常快,因为在查询时您通常只需要在视图中处理几个新文档。

The view runs on every document, but only once. After that, the document's view value(s) are stored forever. Fetching a customer by name will be very fast because you would normally have only a few new documents to process in the view at query time.

查询时间不会明显增加您有更多文件。从技术上讲,访问时间与文档数量成对数增长。但是,实际上,获取文档基本上是固定的时间,不太可能成为问题。

Query time will not increase noticeably if you have more documents. Technically, access times grow logarithmically with the number of documents. However, in practice fetching documents is basically constant time and very unlikely to be a problem.

这篇关于CouchDB查询性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆