mssql-jdbc: Significant performance degradation in SQLServerDatabaseMetadata in 6.4.0

Driver version or jar name

I’m using the 6.4.0.jre8 in comparison to the 6.2.2.jre8.

SQL Server version

Microsoft SQL Server 2012 - 11.0.5343.0 (X64)

Client operating system

Microsoft Windows 10 Pro (10.0.16299)jav

Java/JVM version

Java HotSpot™ 64-Bit Server VM (build 25.144-b01, mixed mode)

Problem description

After upgrading the driver from 6.2.2.jre8 to 6.4.0.jre8 I encounter a serious performance degradation in querying the metadata of the database.

The following screenshot is from the opensource tool symmetricds with the 6.2.2.jre8 driver, where you see a total execution time of 44 seconds for a method.

image

In the second screenshot you see the same code just with using the 6.4.0.jre8 driver, you can see that the total execution time is now 2 times slower (128 seconds).

image

If you tear down the callstack you’ll see that the difference is in the sql server jdbc part where in the later screenshot the getImportedKeys is a lot slower than in the 6.2.2.jre8 version.

Expected behavior and actual behavior

I’d expect that the two drivers should behave equally. At least I don’t expect a performance penalty of 200%.

Repro code

https://github.com/JumpMind/symmetric-ds you have to replace the driver with mssql-jdbc.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

I’ll look into some other options for the prepared statement, but other than that I’ll create the PR in the near future. Thanks for all your time and help.

I’m going to try that right now and see if it resolves some issues I had with drop. It seems to work just fine on SSMS and I’m going to use it over creating a temp table if I can.

Edit: It seems to work just fine, going forward with the implementation. It’s probably going to be awhile before I can create a PR for this issue as it has brought some problems into light, and I’d like to address all of them before proceeding.