使用dbplyr在odbc上进行收集非常缓慢

时间:2019-09-24 13:32:23

标签: r odbc dbi dbplyr

library(pool)
library(dbplyr)
library(DBI)
library(tidyverse)

local_pool <- pool::dbPool(odbc::odbc(), dsn = "my_dsn", PWD = "my_psw")

my_db_tbl <- tbl(local_pool, in_schema('"my_schema"', "my_table_in_oracle")) 

my_db_tbl %>% tally() #200000 (and super fast)
my_db_tbl %>% head(100) #again super fast

在oracle中运行的所有内容都是computations等,对于超过5-million行来说超级快...

但是,如果我想将这200,000行带到R中以使用parsnip等进行建模,则需要花一些时间(一个小时以上)。

我还有另一个只有61,000行的表,这花了半个多小时才恢复到R。

我在做什么错?如何加快速度?

0 个答案:

没有答案