How to optimize the plotly app and reduce latency when a database connection is involved?

I am generating dash plotly apps by fetching data from postgresql, it works fine, however, it shows a latency of upto 5 seconds before actually showing the plots, because I believe that’s because of the connection to postgres and fetching data and doing tiny amount of preprocessing, what are some ways I could reduce it?
Also, my app is in such a way that whenever someone opens the link, it fetches the latest data from postgres tables, how could I change this to (I don’t know the right work tbh) in a way that, the app stores the latest data in the temp memory by itself and is independent of someone opening the link? I am trying to deploy it on aws elasticbeanstalk by the way if that matters.

Maybe you need services like redis or some message queues. But I suggest you start with improving the user experience first, try dcc.loading.