Which is faster/better: an api endpoint that pulls from 9 tables or a task that does it every 2 mins

Options

I am creating an app which has a homescreen that needs to pull data from roughly 9 tables. My current plan is to create a homescreen table that is refreshed with a background task every 2 minutes with the latest data from those 9 tables. That way the homescreen frontend api call only needs to pull from one table to load the homescreen. Is this actually faster/more efficient? I guess it might hinge on how many users we actually get using the app. Has anyone got experience with this in a real-world project?

Best Answer

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Answer ✓
    Options

    Classic answer - it depends! This caching approach seems super reasonable, but it might be worth testing to see how long the data pull takes to determine whether the simplicity and freshness of the data are worth whatever the transaction cost is. Also, you can always refactor bottleneck processes into cached representations like this later on, so I try to start simple and then let the system tell me where the bottlenecks are - and only focus performance questions on those.

Answers