python - 是否可以在多进程中使用 find_raw_batches?
问题描述
我习惯于使用多进程来提高慢速 mongo 查询的性能,但在这些情况下,我使用 $in 将列表输入到查询中,并且要使用多进程,我只需给每个进程一个大小均匀的块列表。
是否可以通过在 find_raw_batches 之上使用多进程来获得有用的性能提升?我担心结果会重叠。
import bson
cursor = db.test.find_raw_batches()
for batch in cursor:
print(bson.decode_all(batch))
解决方案
推荐阅读
- python - Flask 中的函数返回空结果,而同一函数在 Jupyter Notebook 中按预期工作
- c# - 你可以从一个列表中取出一个项目,添加到另一个列表,然后从 C# 中的原始列表中删除项目
- javascript - Node.js - 读取 CSV 文件并调用外部 API
- c# - 基于 C# 的 DLL 包装基于 C 的 DLL 使用问题
- azure - 能否将 SSRS 订阅导出到 Azure 文件共享
- system-verilog - 我可以总是合并@*过程块吗
- c# - 如何将绑定值和 onchange 放在同一个输入复选框中?
- phpmyadmin - MariaDB 将每个单词的首字母大写
- c - 多路径 Tcp / linux 内核的循环调度程序 C 实现
- php - 从头开始 Cron Job PHP localhost