Skip to content

buildParamTypeDefinitions method takes up too much memory space when executing batch insertion of a large number of fields #1678

@CrazyJerryC

Description

@CrazyJerryC

Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it

There are more than 300 fields needed to do the batch insert. I'm looking for a more efficient way to do it. As I researched, bulk copy is a good way. But unfortunately, I have some fields whose type is datetime, bulk copy cannot be used for it. I can only do batch insert through the doExecutePreparedStatementBatch method in SQLServerPreparedStatement. As I monitor the JVM, I found that full GC is very frequent. The following code in the batch loop generates too many String and Char[] objects.
boolean hasNewTypeDefinitions = buildPreparedStrings(batchParam, false);

buildParamTypeDefinitions method in buildPreparedStrings generates exactly the same String value every time. Is it necessary to make this judgment every time? In the case of a large number of fields or data items, performance will be affected.

Describe the preferred solution

Is it possible to consider other ways to determine the variable hasNewTypeDefinitions? For example, compare the order of the Parameter[] array instead of directly generating String value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BacklogThe topic in question has been recognized and added to development backlogEnhancementAn enhancement to the driver. Lower priority than bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions