-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Hi,
I encountered the exact same issue as #1286 wheres a simple query to retrieve a 100mb bytea column from a one table, one row DB takes forever and causes the cpu to spike at 100%, rendering my node instance unresponsive.
After investigating, I think I found the cause in the pg-protocol
package
node-postgres/packages/pg-protocol/src/parser.ts
Lines 91 to 93 in ea6ac2a
combinedBuffer = Buffer.allocUnsafe(this.remainingBuffer.byteLength + buffer.byteLength) | |
this.remainingBuffer.copy(combinedBuffer) | |
buffer.copy(combinedBuffer, this.remainingBuffer.byteLength) |
Which suffers from the same thing as the original issue - too many allocations and buffer copies going around. I believe the fix introduced back then in brianc/node-packet-reader#3 should solve the problem here.
lognaturel