Node.js node js和postgresql降低了Cpu使用率
在Node js中,我使用的是postgresql数据库。当我在DB中插入大量数据时,CPU使用率将达到10%到15% 我想将cpu使用率从5%降低到6%Node.js node js和postgresql降低了Cpu使用率,node.js,postgresql,Node.js,Postgresql,在Node js中,我使用的是postgresql数据库。当我在DB中插入大量数据时,CPU使用率将达到10%到15% 我想将cpu使用率从5%降低到6% function execute(count) { step(0); function step(i) { if (i < count) { client.query("INSERT INTO test1 (firstname, lastname) values($1, $2)",
function execute(count) {
step(0);
function step(i) {
if (i < count) {
client.query("INSERT INTO test1 (firstname, lastname) values($1, $2)", ['Ronald', 'McDonald'], function (err, respose) {
// console.log(respose);
console.log("insert");
step(++i);
});
}
else {
selectQuery();
}
}
}
函数执行(计数){
步骤(0);
功能步骤(i){
如果(i
PostgreSQL在其配置文件中有一个可以缓存数据的指令
shared_buffers=3GB For 16 GB of RAM
该值基于系统RAM的数量,该数量应为RAM的20%什么是“cpu使用率5”?您的数据来自哪里?Postgres支持适当的批量插入(例如,请参见)。