How to improve performance when using an external database

I’m using Velo to retrieve data from an external database and display it to the user.
If you run the preview mode without an external database connected, it will start up in about two seconds.
However, when I connect an external database, it takes 7 seconds. So I measured the time it takes to get the data and it takes about 300ms.
I wonder why there is a delay of 4700ms just by connecting an external database.

As a solution, I tried to use cached data in the backend using the npm module “LRU-Cache”, but it didn’t save the cache. It seems to be running a one-time function, like a serverless function.

Is there a performance solution there? I want to run it in the backend.