当row_at_time太大时,sqlQuery失败并出现内存错误

时间:2016-11-23 06:33:15

标签: sql-server r memory rodbc

我使用RODBC::sqlQuery

将此查询发送到R中的sql server
MERGE "mytable" AS Target USING ( VALUES ('myname','POLYGON ((148.0000000000000000 -20.0000000000000000, 148.0000000000000000 -20.0000000000000000, 148.0000000000000000 -20.0000000000000000, 148.0000000000000000 -20.0000000000000000, 148.0000000000000000 -20.0000000000000000))')) AS Source ("name","polygon")
                   ON (Target."name" = Source."name")
                   WHEN MATCHED THEN
                   UPDATE SET Target."polygon" = Source."polygon"
                   WHEN NOT MATCHED BY TARGET THEN
                   INSERT ("name","polygon")
                   VALUES (Source."name", Source."polygon")
                   OUTPUT $action, Inserted.*, Deleted.*

row_at_time sqlQuery的参数超过10时失败, Error in odbcQuery(channel, query, rows_at_time) : 'Calloc' could not allocate memory (107374182400 of 1 bytes)

但是如果row_at_time< 10.(仍然查询需要相当长的时间,这是令人惊讶的,因为表被索引并且非常小:少于100行)

知道为什么吗? 谢谢

编辑:这是我写的表的结构:

enter image description here

0 个答案:

没有答案