Skip to content

Major performance issues with bytea performance #2240

@regevbr

Description

@regevbr

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions