-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Labels
Milestone
Description
I recently created a database using Google Cloud MySQL (2nd generation) and have been running into some performance issues trying to write data to the database via RMariaDB. Observe the following...
# Connect to database using MariaDB driver (slow)
mycon <- DBI::dbConnect(
drv = RMariaDB::MariaDB(),
dbname = "mydb",
host = "11.111.111.111",
user = "foo",
password = ""
)
# Write table 'iris'
system.time(RMariaDB::dbWriteTable(conn = mycon, name = "iris", value = iris, row.names = FALSE, overwrite = TRUE))
# 9.515 seconds
RMariaDB::dbDisconnect(mycon)
# Connect to database using MySQL driver (fast)
mycon <- DBI::dbConnect(
drv = DBI::dbDriver("MySQL"),
dbname = "mydb",
host = "11.111.111.111",
user = "foo",
password = ""
)
# Write table 'iris'
system.time(RMariaDB::dbWriteTable(conn = mycon, name = "iris", value = iris, row.names = FALSE, overwrite = TRUE))
# 0.441 seconds
# Attempt 1 to append data to table
system.time(RMariaDB::dbAppendTable(conn = mycon, name = "iris", value = iris))
# Error in .local(conn, statement, ...) :
# unused argument (param = unname(as.list(value)))
# Timing stopped at: 0.005 0 0.005
# Attemp 2 to append data to table, using RMySQL
system.time(RMySQL::dbWriteTable(conn = mycon, name = "iris", value = iris, row.names = FALSE, overwrite = FALSE, append = TRUE))
# 0.206 seconds
My questions are
- Should it be possible to write data to a MySQL database on Google Cloud in a reasonable amount of time? (Perhaps I am trying to do something that was not intended to be done.)
- As shown by the error above, I cannot append data to a table using RMariaDB with a MySQL driver. Is this a bug?
For now I am stuck using RMySQL :/
Thanks, I really appreciate all the hard work done on this package!
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
RMariaDB_1.0.6
nbarsch