java—在内存受限的环境中,将basex数据库与Upsert合并/组合

ukdjmx9f  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(111)

我在basex有两个数据库, source_dbtarget_db ,并希望通过在 id 属性,并使用 replaceinsert 取决于是否在中找到该元素 target_db . source_db 有大约100000个元素 target_db 有大约1000000个元素。

<!-- source_db contents -->
<root>
  <element id="1">
  <element id="2">
</root>
<!-- target_db contents -->
<root>
  <element id="1">
</root>

我要合并两个数据库的查询如下所示:

for $e in (db:open("source_db")/root/element)
return (
  if (exists(db:open("target_db")/root/element[@id = data($e/@id)]))
  then replace node db:open("target_db")/root/element[@id = data($e/@id)] with $e
  else insert node $e into db:open("target_db")/root
)

但是,在运行查询时,我不断收到内存约束错误。使用对basex的rest接口的post请求 Out of Main Memory 使用BaseXJava客户端,我得到 java.io.IOException: GC overhead limit exceeded .
理想情况下,我希望只处理来自 source_db 有时是为了避免内存问题,但我的查询似乎没有这样做。我试过使用 db:copynode false 布拉格马,但这并没有什么不同。有没有办法做到这一点?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题