Performance

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Re: Performance

Postby paronne » Tue Feb 09, 2016 7:30 pm

Hi Adrian,

i have my doubts as well about the jdbs driver. I am not sure they can help you with this situation.
I agree with Andrei. Best way is to try to isolate the issue in a sample solution.

Alex i am not sure on how you execute the import but if you iterate over a first foundset and then create new record in a second foundset the slowness during the import may be caused by the iteration over the first foundset as well.
If you iterate over a very big foundset using a normal iteration as "forEach" or for (i<=foundset.getSize()) { } the execution time of each iteration may increase.
If this is the case you can solve it getting bulk of data on the first foundset instead of going over the whole table. In order to do so you require a sortable index;
1) import the first 1000 records (sorted by the index) and iterate over them.
2) Get the next 1000 records (sorted by index and with index > last index retrieved)

//load 1000 records on each iteration:
var index;
var record;
foundset.loadRecords(‘select pk order by yourIndex limit 1000’)
do {
for(var i = 1; i < foundset.getSize(); i++) {
record= foundset.getRecord(i);
// do your operation with the record;
if(i%200 ==0) databaseManager.saveData();
index= record.idx;
}
} while (foundset.loadRecords(‘select pk where yourIndex > index order by yourIndex limit 1000’).getSize());
paronne
 
Posts: 203
Joined: Fri Nov 02, 2012 3:21 pm

Previous

Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 16 guests