get查询和map-reduce查询之间的性能差异是什么?

时间:2019-05-10 11:08:49

标签: couchdb pouchdb

get查询和期望最多查找一个文档的map-reduce查询之间的性能差异是什么?您可以用您认为合适的词或任何一种表示法来表达答案。

获取查询:

    puchDb.get(id)

map-reduce查询:

    const descendants = await pouchDb.query('descendants', {
        include_docs: true,
        startkey: [id],
        endkey: [id, {}],
    });
    const descendantsDocs = descendants.rows.map((item) => {
        return {
            ...item.doc,
        }
    });
    return {
        parent: descendants[0] as IPersistence<ParentType>,
        descendant: descendants.find(
            this.filterDescendants(prefix),
        ),
    }

我认为,由于两个查询都基于一个索引属性进行查找,因此以大O表示形式表示的复杂度约为O(ln(n))

0 个答案:

没有答案