Skip to content

Conversation

Y--
Copy link
Collaborator

@Y-- Y-- commented May 26, 2025

In #784 we introduced a memory context for Postgres scans, to avoid leaking "scratch space" used for things like jsonb serialization to string. It turned out that we were using this memory context too often, particularly around the call to GetNextTuple(). By storing the current tuple in the ephemeral memory context, we would free it before calling GetNextTuple() in the next batch. This would in turn cause issues for index scans, which use the previous tuple to find the next tuple. This PR changes the code to only use the memory context when we're actually inserting the tuple in the DuckDB chunk.

Fixes #796
Fixes #802

@Y-- Y-- requested a review from JelteF May 26, 2025 14:12
@Y-- Y-- enabled auto-merge (squash) May 26, 2025 14:13
@Y-- Y-- force-pushed the yl/fix-large-scan branch from 3c00133 to 57aec64 Compare May 26, 2025 14:28
JelteF
JelteF previously approved these changes May 26, 2025
@Y-- Y-- requested a review from JelteF May 26, 2025 15:02
@Y-- Y-- merged commit e4c053f into main May 26, 2025
6 checks passed
@Y-- Y-- deleted the yl/fix-large-scan branch May 26, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants