When use poolConnection or CreateConnection felixge/node-mysql

后端 未结 2 706
别那么骄傲
别那么骄傲 2021-02-13 17:05

I use https://github.com/felixge/node-mysql for my application When and Why use

db_pool = mysql.createConnection(db);

or

db_p         


        
2条回答
  •  一整个雨季
    2021-02-13 17:28

    A single connection is blocking. While executing one query, it cannot execute others. Hence, your DB throughput may be reduced.

    A pool manages many lazily-created (in felixge's module) connections. While one connection is busy running a query, others can be used to execute subsequent queries. This can result in an increase in application performance as it allows multiple queries to be run in parallel.

提交回复
热议问题