Add explanation for default buffer size
Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
This commit is contained in:
@@ -39,6 +39,10 @@ func New(r io.Reader) *ChunkReader {
|
|||||||
// NewConfig creates and a new ChunkReader for r configured by config.
|
// NewConfig creates and a new ChunkReader for r configured by config.
|
||||||
func NewConfig(r io.Reader, config Config) (*ChunkReader, error) {
|
func NewConfig(r io.Reader, config Config) (*ChunkReader, error) {
|
||||||
if config.MinBufLen == 0 {
|
if config.MinBufLen == 0 {
|
||||||
|
// By historical reasons Postgres currently has 8KB send buffer inside,
|
||||||
|
// so here we want to have at least the same size buffer.
|
||||||
|
// @see https://github.com/postgres/postgres/blob/249d64999615802752940e017ee5166e726bc7cd/src/backend/libpq/pqcomm.c#L134
|
||||||
|
// @see https://www.postgresql.org/message-id/0cdc5485-cb3c-5e16-4a46-e3b2f7a41322%40ya.ru
|
||||||
config.MinBufLen = 8192
|
config.MinBufLen = 8192
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user