Skip to content

Conversation

@Chienlin1014
Copy link
Contributor

@Chienlin1014 Chienlin1014 commented Nov 17, 2025

I observed that the SQL Server DDL for Spring Integration metadata tables defines several critical key columns (e.g., REGION, GROUP_KEY, METADATA_KEY) using the VARCHAR data type.

This configuration creates a type mismatch because the Microsoft JDBC Driver, by default, sends string parameters to SQL Server using the Unicode (NVARCHAR) data type.

Potential Impact and Optimization:

This mismatch necessitates an Implicit Conversion by SQL Server on nearly every lookup. While functional, this conversion can severely compromise the database's ability to utilize indexes optimally. In high-frequency queries involving these key columns, this often forces the database to revert from efficient Index Seek to less efficient Index Scan or Table Scan.

Proposed Solution:

We propose adjusting the relevant VARCHAR columns in the DDL to NVARCHAR. This structural alignment eliminates the potential for implicit conversion, ensuring the DDL is consistent with the parameters sent by the MS JDBC driver, and guaranteeing optimal index utilization.

Precedent for Structural Alignment:

This adjustment addresses an underlying DDL pattern similar to one recently resolved within the Spring ecosystem. For reference, the analogous fix was merged in Spring Batch for its Job Repository DDL:

Spring Batch PR #5065: Fix for SQL Server DDL column definitions

Your guidance and review are highly appreciated.

…y lookups

Signed-off-by: Chienlin <shzerokimo@gmail.com>
@artembilan artembilan added this to the 7.0.0 milestone Nov 17, 2025
@artembilan artembilan enabled auto-merge (squash) November 17, 2025 14:28
@artembilan
Copy link
Member

Thank you, @Chienlin1014 , for contribution!
It will be merged automatically when PR build is green.
Please, consider to investigate this article: https://chris.beams.io/git-commit.

The PR does not have value in the commit history, therefore it would be great to put as much as possible info into the commit message.
Mostly, explaining "Why?".

But thanks anyway.

@artembilan artembilan merged commit fa6a79d into spring-projects:main Nov 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants