这里是SQL新手。在Hello World section of the RMySQL github page , 有以下 -
# You can fetch all results:
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)
dbClearResult(res)
我不明白 dbClearResult()
的用途。这对我很重要,因为我正在处理几个大表,dbClearResult(rs)
有时可能非常慢(需要几分钟才能完成)。但是,如果我进入 mysql shell,我可以立即终止查询。
那么,dbClearResult()
的目的是什么,有什么办法可以避免或加快速度吗?
最佳答案
来自DBI documentation对于 dbClearResult
:
Frees all resources (local and remote) associated with a result set. In some cases (e.g., very large result sets) this can be a critical step to avoid exhausting resources (memory, file descriptors, etc.)
关于mysql - DBI/RMySQL/RMariaDB 中 dbClearResult() 的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51657701/