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();
}