Answer the question
In order to leave comments, you need to log in
What is the difference between a pool connection and a normal one in MySQL?
Hello.
From the documentation - https://github.com/felixge/node-mysql
I can't figure out what to choose, pool or regular, which is more productive?
For example, as I understand it, if I use pool like this (opened pool, connected once and left):
// books.js
mysql.getConnection(function(err, connection) {
connection.query('SELECT * FROM books', function (err, books) {
connection.release();
// ...
});
});
// book.js
mysql.getConnection(function(err, connection) {
connection.query('SELECT * FROM books WHERE id = :id', {id: 12} function (err, books) {
connection.release();
// ...
});
});
Answer the question
In order to leave comments, you need to log in
Muscle is known for having a low connection overhead, so there might not be a big difference. Need to test.
In general, pool is more productive.
If you do not have huge performance requirements (thousands of requests per second), then you can choose any method and not worry.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question