Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(c/driver/postgresql): chunk large COPY payloads #1937

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

lidavidm
Copy link
Member

PostgreSQL apparently has an internal limit - split up batches to stay under that limit. It doesn't care about message boundaries in this mode, so we can chunk naively.

Fixes #1921.

PostgreSQL apparently has an internal limit - split up batches to
stay under that limit.  It doesn't care about message boundaries
in this mode, so we can chunk naively.

Fixes apache#1921.
@lidavidm lidavidm marked this pull request as ready for review June 25, 2024 06:01
@github-actions github-actions bot added this to the ADBC Libraries 13 milestone Jun 25, 2024
Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Some day it may be worth investigating if we can avoid the (potentially huge) intermediary memory copy of an ArrowBuffer (but no need to consider that here).

Comment on lines 575 to 578
// https://github.com/apache/arrow-adbc/issues/1921: PostgreSQL has a max
// size for a single message that we need to respect (1 GiB - 1). Since
// the buffer can be chunked up as much as we want, go for 512 MiB as our
// limit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any advantage to having it be this big from our end? Maybe it's buffered internally in libpq and it doesn't matter, but my intuition might have been something more like 16 MB here (surely it's limited by the network and not our loop).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty arbitrary. I shrunk it to 16MiB.

@lidavidm lidavidm merged commit e58987e into apache:main Jun 26, 2024
64 checks passed
@lidavidm lidavidm deleted the gh-1921 branch June 26, 2024 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

c/driver/postgresql: Strange error when ingesting a very large table
3 participants