如何压缩 PouchDB 中的视图
How to compact views in PouchDB
CouchDB 提供了三个与压缩相关的 API 端点:
- /{db}/_compact 压缩磁盘上的数据。
- /{db}/_compact/{ddoc} 压缩视图
- /{db}/_view_cleanup 清理过时的视图。
PouchDB 为第一个提供了类似的功能。
- compact() 压缩磁盘数据
但其他两个从文档中不清楚。 viewCleanup() 似乎对应于 /{db}/_view_cleanup
,其描述为:
Cleans up any stale map/reduce indexes.
As design docs are deleted or modified, their associated index files (in CouchDB) or companion databases (in local PouchDBs) continue to take up space on disk. viewCleanup() removes these unnecessary index files.
See the CouchDB documentation on view cleanup for details.
但是,描述中的 link 描述了视图压缩(紧接着讨论了视图清理)。
那么 实际上 如何压缩 PouchDB 中的视图?
viewCleanup()
是否同时处理视图清理和压缩?
视图压缩是否包含在compact()
中?
视图压缩不可能吗?
出于某种原因,在 PouchDB 中是否根本不需要视图压缩?
来自source code in pocuhdb-mapreduce.js, it looks like viewCleanup just removes unused view locally and also on remote CouchDB servers. There is no equivalent of a view compaction, because it's not necessary locally – see Nolan's answer on Github.
CouchDB 提供了三个与压缩相关的 API 端点:
- /{db}/_compact 压缩磁盘上的数据。
- /{db}/_compact/{ddoc} 压缩视图
- /{db}/_view_cleanup 清理过时的视图。
PouchDB 为第一个提供了类似的功能。
- compact() 压缩磁盘数据
但其他两个从文档中不清楚。 viewCleanup() 似乎对应于 /{db}/_view_cleanup
,其描述为:
Cleans up any stale map/reduce indexes.
As design docs are deleted or modified, their associated index files (in CouchDB) or companion databases (in local PouchDBs) continue to take up space on disk. viewCleanup() removes these unnecessary index files.
See the CouchDB documentation on view cleanup for details.
但是,描述中的 link 描述了视图压缩(紧接着讨论了视图清理)。
那么 实际上 如何压缩 PouchDB 中的视图?
viewCleanup()
是否同时处理视图清理和压缩?视图压缩是否包含在
compact()
中?视图压缩不可能吗?
出于某种原因,在 PouchDB 中是否根本不需要视图压缩?
来自source code in pocuhdb-mapreduce.js, it looks like viewCleanup just removes unused view locally and also on remote CouchDB servers. There is no equivalent of a view compaction, because it's not necessary locally – see Nolan's answer on Github.