Avoid unnecessary executemany subbatching#1479
Open
bkline wants to merge 1 commit into
Open
Conversation
This commit implements Michael's suggestion to scan as many rows of data as we can for the fast_executemany path when we are determining how many rows we can send with the same binding. It's still possible for an application to provide data in such a way that more than one invocation of SQLExecute() is required. For example, with a table containing a single VARCHAR column, you can force a separate call to SQLExecute() for each row if you alternate back and forth between rows with string values and rows with bytes values. My advice would be: "don't do that." It turns out that--because all the work to scan the rows takes place in memory--the amount of time required to scan even very large sets of values is trivial (less than a half milliseccond to scan 10,000 rows with 16 values each on my development machine) in comparison with the time needed for even a single round trip to the database. Closes mkleehammer#741
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit implements Michael's suggestion to scan as many rows of data as we can for the
fast_executemanypath when we are determining how many rows we can send with the same binding. It's still possible for an application to provide data in such a way that more than one invocation ofSQLExecute()is required. For example, with a table containing a singleVARCHARcolumn, you can force a separate call toSQLExecute()for each row if you alternate back and forth between rows with string values and rows with bytes values. My advice would be: "don't do that."It turns out that--because all the work to scan the rows takes place in memory--the amount of time required to scan even very large sets of values is trivial (less than a half milliseccond to scan 10,000 rows with 16 values each on my development machine) in comparison with the time needed for even a single round trip to the database.
Closes #741