[Mobile Local Storage] Store entire database table or just the records that I need?

[Mobile Local Storage] Store entire database table or just the records that I need?

  

Hi all.

Imagine you have the following scenario: you have a group of orders, and each order is going to be delivered by a company. I want to store both the order and the company details.

When I am fetching the data to store in the local storage of my device, what is the best solution?

1) Get all my orders, check the list of distinct company ids of those orders, and fetch those companies only

2) Get all my orders with the join condition with the company and store everything in a Local Order entity

3) Get all my orders and all the companies that are registered in the database

As I see, all 3 have advantages and disadvantages, but I would probably chose the first one (more processing but better local storage usage). With the second option I will probably have too many times the company details, and the third option might result in a very high number of companies that will never be displayed.

What do you think?

Thanks,

Maria


Hi mariap,

Who will use the app? What that person needs to see?

Cheers,

Eduardo Jauch

The user that is going to have access to the app must be able to see both the order and the company details for each order of that user.