@ftina In that case, you can get help from Jobs.
You can define a job that will fetch records data from API and store in db in every 5 mints interval, in the background.
Once the user tries to fetch data, just fetch from the db, that will reduce your query time, surely.
Cons: In that approach, if your API data change for some reason, you may not get it directly unless your job searches for dissimilar data. Keep it in mind.