You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/10/16 10:48:52 UTC

[GitHub] [shardingsphere] kimmking commented on issue #7809: How to improve efficiency of batch insert ?

kimmking commented on issue #7809:
URL: https://github.com/apache/shardingsphere/issues/7809#issuecomment-709972707


   It seems isToAddDerivedLiteralExpression method will call getGroupedParameters for an empty check every time.
   So we can make two improvement choices:
   - cache the GroupedParameters for one sql and will called 5000 times in multiple values
   - add a new check empty method and avoid new/merge parameters
   
   ```
       private boolean isToAddDerivedLiteralExpression(final InsertStatementContext insertStatementContext, final int insertValueCount) {
           return insertStatementContext.getGroupedParameters().get(insertValueCount).isEmpty();
       }
   
       public List<List<Object>> getGroupedParameters() {
           List<List<Object>> result = new LinkedList<>();
           for (InsertValueContext each : insertValueContexts) {
               result.add(each.getParameters());
           }
           if (null != insertSelectContext) {
               result.add(insertSelectContext.getParameters());
           }
           return result;
       }
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org