首页 \ 问答 \ MongoDB是否比更新集合更快地复制集合?(MongoDB Is copying a collection faster than updating it?)

MongoDB是否比更新集合更快地复制集合?(MongoDB Is copying a collection faster than updating it?)

我在一个集合中有几百万个文档。 我需要在每个文件上执行复杂表达式,然后更新每个文档中的结果值。

我尝试过Eval()和javascript方法。

我尝试过批量更新方法。

他们都需要很多时间才能完成(小时)。 没有填充问题,因为已更新的字段已存在。

但是,如果我将生成的文档存储到新集合中而不是更新原始文档,那么性能是可以接受的。

那么,MongoDB中的更新应该比插入慢吗?

你知道一种不同的方法吗?

谢谢!


I have several million documents in a collection. I'm required to execute a complex expression over each of them and then update a resulting value in each document.

I have tried the Eval() and javascript approach.

I have tried the Bulk Update approach.

They both take many time to complete (hours). There are no padding problems because the updated field already exists.

But, if I store the resulting documents into a new collection instead of updating the original documents, the performance is acceptable.

So, update in MongoDB is supposed to be way slower than insert?

Do you know a different approach?

Thanks!


原文:https://stackoverflow.com/questions/28653226
更新时间:2022-04-19 21:04

最满意答案

该文件可能已经格式化,并且该行已经在底部...如果你没有删除已经使用过的行,通常会跳转或添加行...即使是空的...我们还必须考虑奇怪的事件!


It is possible that the file is already formatted , and that lines are down at the bottom...often excel jumps or add lines if you do not delete the lines already used even if empty...we must also consider strange events!

相关问答

更多
  • 这是Excel文件中唯一的工作表吗? 如果是这样,在执行SQL语句中创建工作表(以及文件)之前,可能更容易使用文件系统任务组件删除整个文件。 Is this the only sheet in your Excel file? If so, it might be easier to use the File System Task component to delete the entire file before creating your sheet (and therefore file) in y ...
  • 由于我不知道您的工作簿结构的细节,您可能需要调整以下vba代码(因为子名称建议将其放在工作簿的Open事件中): Private Sub Workbook_Open() Dim wb As Workbook Dim ws As Worksheet Dim ws2 As Worksheet Dim LastRow As Long Dim LastColumn As Long Dim LastColumnLetter As String Set wb = ThisWorkbook Set ws = wb.W ...
  • 您可以使用Multicast将数据拆分为2个流。 在每个流中,您只返回分隔Q1和Q2数据的相关列,然后使用UNION ALL将它们重新连接在一起。 因此,一个流将具有ID,Q1-Age,Q1-Result1等,以及一个名为source的派生字段,其中添加了Q1的硬编码值,第二个将具有ID,Q2-Age等。这两个数据流在一起。 You could do it with a Multicast that splits the data into 2 streams. In each stream you the ...
  • 你检查过项目属性吗? 可能是BIDS中的项目将以下属性Runas64Bit设置为TRUE。 Thanks for your responses, I've solved the issue by recreating the package from scratch in SSDT2012. Now the package is working. I suspect it could be the Excel drivers. Thanks for your time again. - Madhu
  • 该文件可能已经格式化,并且该行已经在底部...如果你没有删除已经使用过的行,通常会跳转或添加行...即使是空的...我们还必须考虑奇怪的事件! It is possible that the file is already formatted , and that lines are down at the bottom...often excel jumps or add lines if you do not delete the lines already used even if empty...w ...
  • 我相信你的假设是正确的,SSIS在打开时对Excel文件进行独占锁定,并且不与自己共享锁定。 快速返工将添加第二个SSIS包。 这个使用所有Excel数据填充缓存连接管理器。 将缓存文件保留到磁盘 然后在现有的SSIS包中,将Lookup更改为直接使用缓存文件而不是Excel。 现在唯一的锁定应该是Excel目标。 然后,您需要制作调用模式 RunNewCachePackage RunNormalPackage I do believe your assumption is correct, SSIS is ...
  • 简短而甜蜜的回答是否定的。 不可能。 它总是会使用某些东西来区分它。 你可以做的是,使用一个小的poweshell脚本打开excel文件,运行一个小宏来删除第一行,然后保存并关闭它。 有很多PowerShell脚本可以帮助你做到这一点。 Short and sweet answer is no. Not possible. It will always have to use something to make it distinct. What you can do is, use a small pow ...
  • Excel目标偶尔会发生的事情是隐藏的格式化将导致数据流连接器开始在1以外的行中写入数据。 如果发生这种情况,您需要从新的Excel文档重新创建模板,并根据需要重新构建标题。 Something that occasionally happens with Excel destinations is that hidden formatting will cause the data flow connector to begin writing data at a row other than 1. If ...
  • 我们深究了这一点。 为了使数据以正确的格式显示,电子表格开发人员将一行隐藏的值作为电子表格的第一行。 如果你想让你的号码成为数字,这是你必须做的事情。 所以,一个0被放置在单元格的列中,该单元格是数字,日期列的每个单元格中的日期,以及所有文本列的撇号(')。 后者不是绝对必要的,当他们被删除时,电子表格似乎开始工作。 然而,这一点的特点是电子表格在整个运输环境中都能正常工作。 只有在当地发展过程中,才会出现问题。 如果任何人可以更多地了解这是为什么,那么将非常感激。 We got to the bottom ...
  • @Pubs,我认为,您可以考虑使用Aspose.Cell for .NET API,因为它们不需要Excel应用程序的可用性来动态创建,操作或转换电子表格。 而且,这些API提供了将数据导入工作表的方法的真实性,例如从Array,ArrayList,DataTable,DataColumn,DataView,DataGrid,DataReader和GridView 导入数据 。 此外,如果您在电子表格中具有预先配置的图表,则可以简单地更新图表的数据源以使用新数据进行刷新,或者从头创建图表以最终将图表/电子表 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)