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
最满意答案
该文件可能已经格式化,并且该行已经在底部...如果你没有删除已经使用过的行,通常会跳转或添加行...即使是空的...我们还必须考虑奇怪的事件!
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 ...
-
自动通过SSIS生成的Excel中创建图表?(Create Graphs automatically out of the excel generated via SSIS?)[2023-06-01]
由于我不知道您的工作簿结构的细节,您可能需要调整以下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 Lookup to Excel文件导致导出到excel目标失败(SSIS Lookup to Excel file causes export to excel destination to fail)[2022-07-10]
我相信你的假设是正确的,SSIS在打开时对Excel文件进行独占锁定,并且不与自己共享锁定。 快速返工将添加第二个SSIS包。 这个使用所有Excel数据填充缓存连接管理器。 将缓存文件保留到磁盘 然后在现有的SSIS包中,将Lookup更改为直接使用缓存文件而不是Excel。 现在唯一的锁定应该是Excel目标。 然后,您需要制作调用模式 RunNewCachePackage RunNormalPackage I do believe your assumption is correct, SSIS is ... -
将数据导出到Excel工作表,而无需在SSIS中编写列名称(Exporting data to Excel sheet without writing column names in SSIS)[2022-03-04]
简短而甜蜜的回答是否定的。 不可能。 它总是会使用某些东西来区分它。 你可以做的是,使用一个小的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 ...
-
以编程方式填充Excel模板而不安装Excel(Populating an Excel template programmatically without Excel installed)[2021-12-23]
@Pubs,我认为,您可以考虑使用Aspose.Cell for .NET API,因为它们不需要Excel应用程序的可用性来动态创建,操作或转换电子表格。 而且,这些API提供了将数据导入工作表的方法的真实性,例如从Array,ArrayList,DataTable,DataColumn,DataView,DataGrid,DataReader和GridView 导入数据 。 此外,如果您在电子表格中具有预先配置的图表,则可以简单地更新图表的数据源以使用新数据进行刷新,或者从头创建图表以最终将图表/电子表 ...