farm command
farm command

Reputation: 693

is it better to fetch all data all at once or make seperate calls

performance-wise which approach is better:

1) make a fetch and get 100 records all at once

2) make a fetch for each row of data individually (100 times)

P.S. I use axios

Upvotes: 0

Views: 1515

Answers (2)

Scott McCulloch
Scott McCulloch

Reputation: 465

In 2019, any solution like this is less about performance and more about user experience.

Most users do not like delays, so you want to be as responsive as possible. If that is many small requests to enable to the user to do something (instead of waiting 1-2 seconds for the larger request to return) you should prefer that solution. It's dependant on what your on screen experience is like.

Having said that, 100 records is not a very big payload (generally), so if it's quite small and possibly cached, you could just get the whole 100 at once.

Upvotes: 1

Frankely Diaz
Frankely Diaz

Reputation: 906

That will depend on the size of your row of data. There is no right answer to pick between the options you provided. I will think more along the lines of what is the maximum amount of records that I could fetch that won't slow down the client requesting them.

Upvotes: 1

Related Questions