Fastest way to load data in R shiny application


I am loading data from mysql intop my web application. But it's taking a bit higher time. Is there any other method to load data faster in the application.

con= dbConnect(drv = RMySQL::MySQL(), dbname = "database",
host = "", port=3306,
user = "ank123", password = "123456789")

master<-dbReadTable(dbGetQuery(con, sql("select column 1, column 2, column 3....column 8 from table_name")))

I tired- data.table, data.frame , they are taking near about equal time.

hi @Ankush, that's an interesting question! It's hard to say based on this why your data retrieval is slow.

Some questions that I have when reading this:

  • are you sure the delay is in loading the data and not in something else like calling a reactive multiple times? you could use the library profvis to see if it's the data loading
  • do you need to load the data realtime from the database? If not, you could first export the data to a file and read that into R. There are some packages like feather or fst that are designed to load data quickly. It also depends on your data structure, which method gives the best result.
  • did you do any database optimizations like creating indexes? This can speed up the select query considerable.
1 Like

Hio @ginberg-

  1. I had run the single data loading command and it is taking more time.
  2. No, I don't need the real time data
  3. The DB guys are working on it.

Will surely, use the 2nd option.

Can you also help me in saving the data in the database?

good you are making progress with the data loading.

Have you tried any solutions yourself to save the data in the database? The database site of Rstudio might be helpful for you.


Thanks. Will surely
look into this.

1 Like

This topic was automatically closed 54 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.