Hi,

I'd like to sync my products on the device's local database.
I'm following OutSystems' best practice for creating the sync process.

  1. The first step is getting products from the database.
  2. Delete all local records from the device.
  3. CreateUpdateAll action for creating records on the local database.

During the creating records to the local database, It takes too long and never ends. The application crashes and closed automatically. The amount of data minimum 600.000 records sometimes more.

Also, there is no error log on service center.
If I debug the app with service studio with "break on all exceptions" studio doesn't break on application crash.

Here is my action.

Hi Ferhat,

Syncing 600k+ records to local storage is really a lot.

Do you really need all product records on the mobile device?

If so here are some considerations to improve the sync process:

  • only download the attributes that you really need
  • only download searchable/list attributes, then for getting details of a product you could get the details from server and store them locally.
  • if you have statistics on most courant products you could decided to only sync those by default, and all others search on server and store locally when users search for it.
  • you can also consider sync an x-number of products during each sync call to avoid the timeout that you run it.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi Ferhat,

Syncing 600k+ records to local storage is really a lot.

Do you really need all product records on the mobile device?

If so here are some considerations to improve the sync process:

  • only download the attributes that you really need
  • only download searchable/list attributes, then for getting details of a product you could get the details from server and store them locally.
  • if you have statistics on most courant products you could decided to only sync those by default, and all others search on server and store locally when users search for it.
  • you can also consider sync an x-number of products during each sync call to avoid the timeout that you run it.

Regards,

Daniel

Hi Daniel,

Thank you for your advice.

We don't have a connection to the company server from outside. The requirement is to sync all records in every morning to mobile devices and use them outside of the company.

When I sync these records on OutSystems mobile emulator (Chrome) It takes max 1 mins.
But on the real device, It takes approximately 15 mins. Of course, the emulator is a computer, the mobile device is an Ipad there is a huge performance difference between devices.

Maybe I can find an alternative way to store the data on device more efficient way or someone else can offer their advice. Also, I'll try to use your latest advice. (Sync x number of the product.)


Solution

Hi all,

I found a solution to my problem and I'd like to share with other community members and get your ideas.
As all you know, OutSystems using SQL Lite for the local database. I referenced a git project named SQL Lite Porter to my project. I can access to local device database and write my own queries with that component.

https://github.com/dpa99c/cordova-sqlite-porter.git

When I try to insert about 700K record to IPAD local database, It takes between 15 - 30 seconds even I have a VPN connection. I'm using a SQL transaction during creating records into the database.

I'm wondering why there is a huge duration difference between Outsystems (CreateOrUpdate) action and a normal SQL query.

Any ideas?

Solution