Skip to content

NamedParameterJdbcTemplate + Null parameters = Bad performance [DATAJDBC-594] #816

@spring-projects-issues

Description

@spring-projects-issues

Ricardo Mayerhofer opened DATAJDBC-594 and commented

We've been investigating an issue where we had a 100x performance drop when switching from JdbcTemplate to NamedParameterJdbcTemplate in batch update operations.

We found out that the root cause is the handling of null values by StatementCreatorUtils:setNull, which in turn calls getParameterMetadata from the connection. It seems this issue a database call for every row to be inserted (call stack from profiler attached) which basically kills the performance gains of the batch insert.

We're using Postgres as back-end database. Spring JDBC 5.2.5 (didn't find the correct version on the list, maybe I messed up with something).

Thanks


Affects: 2.0.3 (Neumann SR3)

Attachments:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions