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

Performance optimizations when bulk loading large amounts of timestamps #2194

Merged
merged 4 commits into from Nov 2, 2023

Conversation

hannes92
Copy link
Contributor

While writing software to sync a couple of hundred million rows from another rdbms to sql server via the BulkCopy API, I discovered a disproportioned amount of time was spent serializing Timestamp objects to then deserialize them into Timestamp objects once again.
My fix for this is to be able to accept Timestamp objects directly (which should cover the majority of objects passed) and only serialize them once when passing the date values to the TDSWriter.

I have attached an example to show the difference while importing about 600k rows with 16 columns with dates only.
image

@hannes92
Copy link
Contributor Author

hannes92 commented Aug 15, 2023 via email

@Jeffery-Wasty
Copy link
Member

Thank you for the PR @hannes92. We'll review it when we're able to and get back to you with our next steps.

@lilgreenbird lilgreenbird added this to In progress in MSSQL JDBC via automation Aug 16, 2023
@lilgreenbird
Copy link
Member

could you please add a test which covers the scenario

@hannes92
Copy link
Contributor Author

Added a test case, I lowered the mount of rows inserted to 10000 to not slow down the test suite

@Jeffery-Wasty Jeffery-Wasty moved this from In progress to Under Peer Review in MSSQL JDBC Sep 8, 2023
@Jeffery-Wasty
Copy link
Member

Hi @hannes92,

The PR passes our internal testing, we'll now be reviewing it.

public class BulkCopyTimestampTest extends AbstractTest {

public static final int COLUMN_COUNT = 16;
public static final int ROW_COUNT = 10000;
Copy link
Member

Choose a reason for hiding this comment

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

it's not really necessary to do this that many times, just make sure this is run at last once cover the newly added code

Copy link
Member

@lilgreenbird lilgreenbird left a comment

Choose a reason for hiding this comment

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

please make changes as per comments

MSSQL JDBC automation moved this from Under Peer Review to In progress Sep 22, 2023
@lilgreenbird lilgreenbird added this to the 12.5.0 milestone Sep 22, 2023
@lilgreenbird
Copy link
Member

@hannes92

@tkyc
Copy link
Member

tkyc commented Oct 18, 2023

After making the newly requested changes, LGTM.

@lilgreenbird lilgreenbird merged commit a762d7c into microsoft:main Nov 2, 2023
17 checks passed
MSSQL JDBC automation moved this from In progress to Closed/Merged PRs Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
MSSQL JDBC
  
Closed/Merged PRs
Development

Successfully merging this pull request may close these issues.

None yet

4 participants