I'm using JDBC on GoogleScript to communicate with GoogleCloud MySQL.
My table has 24 columns and it takes about 30 seconds for a 1000 row ResultSet to be loaded into the array. The loop in the code block below takes up most of that time.
Did I make any mistakes that caused it to be this slow? Is there a way to optimize this? Are there better approaches?
var results = stmt.executeQuery(query);
results.last();
var nrow = results.getRow()
results.first();
var ncol = results.getMetaData().getColumnCount();
var dat = new Array(nrow);
for (var i = 0; i<nrow; i++){
dat[i]=new Array(ncol);
for(var j = 0; j<ncol; j++){
dat[i][j] = results.getString(j+1);
}
results.next();
}
Had the same problem and realized that it was caused by the new V8 runtime migration. I went back to the old one and it worked, it got faster. I don´t really know why it's not working well with the new version... it's supposed to be better =/
Anyway, you can change back to the old Rhino version in the menu Run > Disable new Apps Script powered by V8.
Hope this helps. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With