Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Google Cloud SQL advertises that it's only $0.0150 per hour for the smallest machine type, and I'm being charged for every hour, not just hours that I'm connected. Is this because I'm using a pool? How do I setup my backend so that it queries the cloud db only when needed so I don't get charged for every hour of the day?

const mysql      = require('mysql');
const pool = mysql.createPool({
    host : process.env.SQL_IP,
    user     : 'root',
    password : process.env.SQL_PASS,
    database : 'mydb',
    ssl      : {
          [redacted]
    }
});

function query(queryStatement, cB){
  pool.getConnection(function(err, connection) {
    // Use the connection
    connection.query(queryStatement, function (error, results, fields) {
      // And done with the connection.
      connection.destroy();
      // Callback
      cB(error,results,fields);

    });
  });
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
181 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...