Hi all,
I have a fairly simply Google Apps Script web app, that uses the JDBCGoogleCloud connection to connect to a Google cloud mySQL database. It's a system that allows users at a conference to do things like vote, mark their attendance, and indicate they want to speak. It runs as an embedded web applet on a Google Site.
There are only a dozen or so tables, and the largest table is around 200 rows with around 6 columns. Data is mostly varchar's, a timestamp, and some tinyint's.
This is working fine, but performance varies wildly. I can run the same "SELECT * FROM TABLENAME" query 10 times in a row, and it will vary from around 1 second, to as much as 70 seconds, to return the data each time.
Any thoughts on why this is? it makes the system hard to rely on.
Sample bit of code:
var myDBInfo = getDBSettings()
var conn = Jdbc.getCloudSqlConnection(myDBInfo.ConnString,myDBInfo.DBUser, myDBInfo.DBPassword)
var stmt = conn.createStatement()
var query = "SELECT * from Attendance"
rs = stmt.executeQuery(query)
//Get columns
var meta=rs.getMetaData();
var cols=meta.getColumnCount();
var info=[];
for( var i =1; i <= cols; i ++ )
{
info[i] = { label:meta.getColumnLabel(i), type:meta.getColumnTypeName(i) }
}
//get data
var ret = [];
while( rs.next())
{
var row = {};
for( var i=1; i <= cols; i ++ )
{
row[info[i].label] = rs.getString(i)
}
ret.push( row );
}
rs.close()
stmt.close()
conn.close()