GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — fix: convert rows in batches for fetchone() and cursor iteration by maharanay22 · Pull Request #982 · databricks/databricks-sql-python ConversationWhat type of PR is this?
DescriptionFixes #981. Iterating a cursor ( This PR moves Timings on 20,000 rows (bigint + string) from an in-memory Arrow queue:
One trade-off: the first How is this tested?
New tests in Related Tickets & DocumentsFixes #981. Affects every backend's
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
3 tasks done
maharanay22
force-pushed
the
fix-row-iteration-performance
branch
2 times, most recently
from
06d09d1 to
1fae6cc
Compare
fetchone() fetched a single row and ran it through _convert_arrow_table, which builds a pandas DataFrame per call. That fixed cost made iterating a cursor, or any fetchone() loop such as SQLAlchemy's default result iteration, about 1 ms per row, more than 100x slower than fetchall(). ResultSet now implements fetchone(), fetchmany() and fetchall() once for all backends. fetchone() fetches and converts arraysize rows at a time and serves them from a small buffer that keeps both the converted rows and the raw batch. Every other fetch method drains that buffer first, so ordering and counts are unchanged when row and Arrow/columnar/JSON fetches are mixed, and rownumber still reports the number of rows handed to the caller. Signed-off-by: Maha Rana Yadavalli <[email protected]>
maharanay22
force-pushed
the
fix-row-iteration-performance
branch
from
1fae6cc to
2c5b5cc
Compare
Signed-off-by: Maha Rana Yadavalli <[email protected]>
2 tasks done
Signed-off-by: Maha Rana Yadavalli <[email protected]>
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
4 tasks done
This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Iterating a cursor or calling fetchone() in a loop is 100x+ slower than fetchall() (affects SQLAlchemy)Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |