Parallel query to a sql server DB

We would like to know the best possible way to launch all this queries at the same time, when the user press click:

con_saf_17 <- DBI::dbConnect(odbc::odbc(),.connection_string = paste0("Driver={ODBC Driver 17 for SQL Server};Server=", safectado_pro[1], ",", safectado_pro[2], ";Database=",safectado_pro[3], ";UID=", safectado_pro[4], ";PWD=", safectado_pro[5]))

consulta_saf <- function(query){
t_ini <- now()
tib <- dbGetQuery(con_saf_17,query)
t_fin <- now()
tiempo <- round(t_fin - t_ini, 2)
list(tib = tib, tiempo = tiempo,t_ini=t_ini, t_fin=t_fin)
}

b <- eventReactive(input$click,{consulta_saf(consulta_sf_btp)})
c<- eventReactive(input$click,{consulta_saf(c_saf_voz)})
a <- eventReactive(input$click,{consulta_saf(consulta_sf_inc)})

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.