CouchDB视图和设计文档

编程入门 行业动态 更新时间:2024-10-26 03:38:35
本文介绍了CouchDB视图和设计文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

对于CouchDB,您可以创建多个视图和/或多个设计文档。

For CouchDB you can create multiple views and/or multiple design documents.

将视图分组到同一设计文档中还是将每个视图保留在自己的视图中更好?设计文档?

Is it better to group views in the same design document or keep each view to its own design document?

推荐答案

内部,每个设计文档中的视图都在视图组中一起管理。每个视图组在访问时都会生成一个单独的视图服务器-即,如果有8个视图组,则将有8个JavaScript进程。这当然具有设计和性能方面的含义。从CouchDB 文档,

Internally, views within each design document are managed together in a "view group". Each view group spawns a separate view server when accessed - i.e. if there are 8 view groups, you will have 8 JavaScript processes. This certainly has design and performance implications. From the CouchDB documentation,

当确定同一视图组中的一个视图(即,在一个设计文档中定义的所有视图)需要重建时,将发生视图索引重建。例如,如果您有一个具有不同视图的设计文档,并且更新了数据库,则设计文档中的所有三个视图索引都将被更新。

View index rebuilds occur when one view from the same the view group (i.e. all the views defined within a single a design document) has been determined as needing a rebuild. For example, if you have a design document with different views, and you update the database, all three view indexes within the design document will be updated.

因此,从设计/部署角度看,您需要了解,更改单个视图将重新生成设计文档中的所有其他视图。您可以使用此技巧在后台构建它们,但仍将构建所有这些该小组中的意见如此昂贵。

So, from a design/deployment perspective, you need to be aware that changing a single view will rebuild all of the other views within the design document. You can use this trick to build them in the background but it is still going to build all of the views in the group so is potentially expensive.

您也可以利用视图组-视图服务器关系来发挥自己的优势。例如,如果您的CPU具有8个核心,则可能会有8个视图组,每个核心1个视图组,以改善并行性。

You can also use the view group-view server relationship to your advantage. For example, if you have a CPU with 8 cores you might have 8 view groups, 1 for each core, to improve parallelism.

更多推荐

CouchDB视图和设计文档

本文发布于:2023-10-30 03:58:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541689.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   文档   CouchDB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!