SQL novice here. In the Hello World section of the RMySQL github page, there is the following -
# You can fetch all results:
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)
dbClearResult(res)
I don't understand the purpose of dbClearResult()
. This is important to me because I'm working with a few large tables and dbClearResult(rs)
can be very slow at times (taking minutes to complete). However, if I go into the mysql shell I can simply kill a query instantaneously.
So, what is the purpose of dbClearResult()
and is there any way to avoid it or speed it up?
From the DBI documentation for 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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With