I have an SQLite DB that I am using in a shiny app. My queries work quite quickly when there are only one person that has the connection to the DB open, however when there are more than one person it becomes quite slow. The table I am querying is quite large. 870k rows by 67 columns. I'm a little confused why it lags so much when multiple people are using it though. Any thoughts / suggestions would be greatly appreciated.
poolfinderdatabase <- dbPool(drv = SQLite(), dbname = "NewDB")
output$poolfinderTS <- renderPlotly({
PF_TimesSeries <- tbl(poolfinderdatabase, "NewDB")%>%
filter( CPN %in% local(input$Coupon1),Story %in%
local(input$PoolStories1), Coll %in%
local(input$Agency1),WALA >=
local(input$wala_sliders[1]) & WALA<=
local(input$wala_sliders[2]),
Current.Face >= 5000000)%>%
collect()%>%
mutate(Coll = gsub("FGLMC", "FNCL",Coll))%>%
group_by(Date,CPN,Story,Coll)%>%
summarize(Median = median(get(input$Y1),na.rm = TRUE))%>%
ungroup()%>%
mutate(Date =parse_date_time(x = Date, orders =
c("mdy","ymd")))%>%
mutate(Product = paste(Coll," ",CPN," ",Story))
TimeSeries_Chart <- ggplot(PF_TimesSeries,
aes(Date,Median, group = 1,colour =
Product, text=paste(
"</br> Date:", PF_TimesSeries$Date,
"</br> Value:", round(PF_TimesSeries$Median, 3),
"</br> Product:",PF_TimesSeries$Product)))+
geom_line()+
theme_minimal()+
theme_light()+
scale_color_hue(l=40, c=80)
ggplotly(TimeSeries_Chart,tooltip = "text")
})