如何优化过滤:Rethink db

How to optimize filtering : Rethink db

简介

我一直在使用 ReThink Db 使用数据资源管理器选项卡。我是 Rethink Db 的新手。

我创建了这个查询来过滤基于日期的记录。我需要优化查询,以便减少处理大记录所需的时间。

r.db('test').table('usrz').filter(function(test) {
               return test("createdDate").date().during(
                 r.time(2016,12,20, 'Z'),
                 r.time(2016,12,30, 'Z'))
}).orderBy(r.desc('createdDate'))

任何帮助或参考都将不胜感激。谢谢你的时间。

可以使用索引优化RethinkDB 查询。 (参见 https://www.rethinkdb.com/docs/secondary-indexes/javascript

创建索引:

r.table('usrz').indexCreate('createdDate')

通过将 filter/during 组合转换为 between 并将 index 参数添加到 [=15],可以将您的查询转换为使用该索引=]