You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
Hi!
Recently, when testing an application that does huge INSERTs (~60 mb in a single query) I discovered that these queries were much slower with nodejs pg-native driver than with just plain psql < file.sql. By "much slower" I mean 7-11 seconds with psql and 60-90 seconds with nodejs. It doesn't reproduce with all server configurations - I assume it reproduces better when the server has limited RAM and slow disks (HDDs).
After some digging I finally captured network traffic between the client and postgresql server and I discovered that nodejs and psql really send queries in different ways!
nodejs pg-native:
psql:
This test was done with pg-native, but the same also happens with pg.
'Q' is the "query" message and 'P' is the "parse" message. This means that nodejs seems to send a prepare+execute pair instead of just query.
So I obviously want to disable this behaviour - can you please add an option for it?
(PDO in PHP has one, it's called PDO::ATTR_EMULATE_PREPARES)
UPD: Rechecked with pg. It's OK, it was slow in my case because I actually had some bind variables there. With pg-native, however, the case is valid - prepare emerges out of nowhere :).
The text was updated successfully, but these errors were encountered:
Hi!
Recently, when testing an application that does huge INSERTs (~60 mb in a single query) I discovered that these queries were much slower with nodejs
pg-native
driver than with just plainpsql < file.sql
. By "much slower" I mean 7-11 seconds with psql and 60-90 seconds with nodejs. It doesn't reproduce with all server configurations - I assume it reproduces better when the server has limited RAM and slow disks (HDDs).After some digging I finally captured network traffic between the client and postgresql server and I discovered that nodejs and psql really send queries in different ways!
nodejs pg-native:
psql:
This test was done withpg-native
, but the same also happens withpg
.'Q' is the "query" message and 'P' is the "parse" message. This means that nodejs seems to send a prepare+execute pair instead of just query.
So I obviously want to disable this behaviour - can you please add an option for it?
(PDO in PHP has one, it's called PDO::ATTR_EMULATE_PREPARES)
UPD: Rechecked with
pg
. It's OK, it was slow in my case because I actually had some bind variables there. Withpg-native
, however, the case is valid - prepare emerges out of nowhere :).The text was updated successfully, but these errors were encountered: