1

我在一个模式下有 6 个表。我使用 DBI::dbGetQuery 查询所有表,每行有 300 000 行,如下所示:

myRedshift <- DBI::dbConnect(RPostgreSQL::PostgreSQL(), 
                             dbname = 'dbname',
                             host = 'host',
                             port = 5439,
                             user = "user", 
                             password = "password")

 cis_has_bdpm_data <- data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table1"))
cis_cip_bdp_data <- data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table2"))
medicam_data <- data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table3"))
outpatient_data <- data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table4"))
open_medic_data <- data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table5"))
hospital_drugs_data <- data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table5"))
pmsi_data  <-data.frame( DBI::dbGetQuery(myRedshift, "select * from synapps.table6"))

但它很慢,查询所有表需要 1 分钟。所以我的问题是:花这么长时间正常吗?有没有办法加快速度?

4

0 回答 0