I need to write a large data.table to a PostgreSql table on the same computer (Ubuntu 64bit, 16GB RAM).
Before sending the following commands, the System Monitor show 47% Memory used (3% Swap), but in the middle of the long time of running dbWriteTable, it reaches 99% Memory and also 49% Swap.
library(data.table)
library(RPostgreSQL)
my.df <- data.frame(my.dt)
rm(my.dt)
dbWriteTable(con, name="tableindb", value=my.df)
The table has mostly numeric columns, but also time (Posix) and a few character columns.
How can this large RAM use be avoided? After 1 hour, the dbWriteTable-command is still running...