<h2 dir="auto">Question</h2>
<p dir="auto">batch insert 10000 record by default  just need 2~3 second，but use sharding-jdbc insert need more than 2 minutes。<br>
how to optimize it to improve efficiency？</p>
<p dir="auto">maven version：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15796879/67942417-bce13f00-fc12-11e9-9f23-e0a46f4fa8bb.png"><img src="https://user-images.githubusercontent.com/15796879/67942417-bce13f00-fc12-11e9-9f23-e0a46f4fa8bb.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">test case result：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15796879/67942458-cf5b7880-fc12-11e9-806e-ff061ec17cdb.png"><img src="https://user-images.githubusercontent.com/15796879/67942458-cf5b7880-fc12-11e9-806e-ff061ec17cdb.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">database：Mysql 5.7</p>
<h3 dir="auto">Dependence</h3>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        &lt;dependency&gt;
            &lt;groupId&gt;com.oracle.database.jdbc&lt;/groupId&gt;
            &lt;artifactId&gt;ojdbc8&lt;/artifactId&gt;
            &lt;version&gt;12.2.0.1&lt;/version&gt;
        &lt;/dependency&gt;
             &lt;dependency&gt;
            &lt;groupId&gt;org.apache.shardingsphere&lt;/groupId&gt;
            &lt;artifactId&gt;shardingsphere-jdbc-core&lt;/artifactId&gt;
            &lt;version&gt;5.0.0-alpha&lt;/version&gt;
        &lt;/dependency&gt;"><pre class="notranslate">        &lt;<span class="pl-ent">dependency</span>&gt;
            &lt;<span class="pl-ent">groupId</span>&gt;com.oracle.database.jdbc&lt;/<span class="pl-ent">groupId</span>&gt;
            &lt;<span class="pl-ent">artifactId</span>&gt;ojdbc8&lt;/<span class="pl-ent">artifactId</span>&gt;
            &lt;<span class="pl-ent">version</span>&gt;12.2.0.1&lt;/<span class="pl-ent">version</span>&gt;
        &lt;/<span class="pl-ent">dependency</span>&gt;
             &lt;<span class="pl-ent">dependency</span>&gt;
            &lt;<span class="pl-ent">groupId</span>&gt;org.apache.shardingsphere&lt;/<span class="pl-ent">groupId</span>&gt;
            &lt;<span class="pl-ent">artifactId</span>&gt;shardingsphere-jdbc-core&lt;/<span class="pl-ent">artifactId</span>&gt;
            &lt;<span class="pl-ent">version</span>&gt;5.0.0-alpha&lt;/<span class="pl-ent">version</span>&gt;
        &lt;/<span class="pl-ent">dependency</span>&gt;</pre></div>
<h3 dir="auto">Execute sql</h3>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" SELECT JS_SERV_TYPE_TMP_SEQ.NEXTVAL FROM dual "><pre class="notranslate"> <span class="pl-k">SELECT</span> <span class="pl-c1">JS_SERV_TYPE_TMP_SEQ</span>.<span class="pl-c1">NEXTVAL</span> <span class="pl-k">FROM</span> dual </pre></div>
<h3 dir="auto">Sql description</h3>
<ul dir="auto">
<li>JS_SERV_TYPE_TMP_SEQ is a sequence, not a table</li>
<li>dual is a keyword, not a table</li>
</ul>
<h3 dir="auto">Execute error report</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="11:08:59.524 [main] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession
11:08:59.530 [main] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@38883a31] was not registered for synchronization because synchronization is not active
11:08:59.548 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
11:08:59.548 [main] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection@73893ec1] will not be managed by Spring
11:08:59.588 [main] DEBUG ServTypeTmp.insert!selectKey - ==&gt;  Preparing: SELECT JS_SERV_TYPE_TMP_SEQ.NEXTVAL FROM dual 
11:08:59.998 [main] DEBUG ServTypeTmp.insert!selectKey - ==&gt; Parameters: 
11:09:03.781 [main] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@38883a31]
11:09:03.782 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
Exception in thread &quot;main&quot; org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not route tables for `[dual, JS_SERV_TYPE_TMP_SEQ]`, please make sure the tables are in same schema.
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
	at com.sun.proxy.$Proxy31.insert(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:237)
	at com.xxx.mybatis.dao.base.BaseDaoImpl.create(BaseDaoImpl.java:72)
	at com.xxx.mybatis.dao.ServTypeTmpDAOImpl.createServTypeTmpOK(ServTypeTmpDAOImpl.java:20)
	at com.xxx.mybatis.ShardingJdbcProgram.main(ShardingJdbcProgram.java:50)
Caused by: org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not route tables for `[dual, JS_SERV_TYPE_TMP_SEQ]`, please make sure the tables are in same schema.
	at org.apache.ibatis.executor.keygen.SelectKeyGenerator.processGeneratedKeys(SelectKeyGenerator.java:92)
	at org.apache.ibatis.executor.keygen.SelectKeyGenerator.processBefore(SelectKeyGenerator.java:47)
	at org.apache.ibatis.executor.statement.BaseStatementHandler.generateKeys(BaseStatementHandler.java:140)
	at org.apache.ibatis.executor.statement.BaseStatementHandler.&lt;init&gt;(BaseStatementHandler.java:63)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.&lt;init&gt;(PreparedStatementHandler.java:39)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.&lt;init&gt;(RoutingStatementHandler.java:45)
	at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:502)
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:47)
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)
	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)
	... 5 more
Caused by: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not route tables for `[dual, JS_SERV_TYPE_TMP_SEQ]`, please make sure the tables are in same schema.
	at org.apache.shardingsphere.sharding.route.engine.type.unconfigured.ShardingUnconfiguredTablesRoutingEngine.route(ShardingUnconfiguredTablesRoutingEngine.java:55)
	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:70)
	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:55)
	at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:59)
	at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:57)
	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:52)
	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:266)
	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:198)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
	at com.sun.proxy.$Proxy35.execute(Unknown Source)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:62)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:78)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
	at org.apache.ibatis.executor.keygen.SelectKeyGenerator.processGeneratedKeys(SelectKeyGenerator.java:68)
	... 21 more"><pre class="notranslate"><code class="notranslate">11:08:59.524 [main] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession
11:08:59.530 [main] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@38883a31] was not registered for synchronization because synchronization is not active
11:08:59.548 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
11:08:59.548 [main] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection@73893ec1] will not be managed by Spring
11:08:59.588 [main] DEBUG ServTypeTmp.insert!selectKey - ==&gt;  Preparing: SELECT JS_SERV_TYPE_TMP_SEQ.NEXTVAL FROM dual 
11:08:59.998 [main] DEBUG ServTypeTmp.insert!selectKey - ==&gt; Parameters: 
11:09:03.781 [main] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@38883a31]
11:09:03.782 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not route tables for `[dual, JS_SERV_TYPE_TMP_SEQ]`, please make sure the tables are in same schema.
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
	at com.sun.proxy.$Proxy31.insert(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:237)
	at com.xxx.mybatis.dao.base.BaseDaoImpl.create(BaseDaoImpl.java:72)
	at com.xxx.mybatis.dao.ServTypeTmpDAOImpl.createServTypeTmpOK(ServTypeTmpDAOImpl.java:20)
	at com.xxx.mybatis.ShardingJdbcProgram.main(ShardingJdbcProgram.java:50)
Caused by: org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not route tables for `[dual, JS_SERV_TYPE_TMP_SEQ]`, please make sure the tables are in same schema.
	at org.apache.ibatis.executor.keygen.SelectKeyGenerator.processGeneratedKeys(SelectKeyGenerator.java:92)
	at org.apache.ibatis.executor.keygen.SelectKeyGenerator.processBefore(SelectKeyGenerator.java:47)
	at org.apache.ibatis.executor.statement.BaseStatementHandler.generateKeys(BaseStatementHandler.java:140)
	at org.apache.ibatis.executor.statement.BaseStatementHandler.&lt;init&gt;(BaseStatementHandler.java:63)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.&lt;init&gt;(PreparedStatementHandler.java:39)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.&lt;init&gt;(RoutingStatementHandler.java:45)
	at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:502)
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:47)
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)
	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)
	... 5 more
Caused by: org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not route tables for `[dual, JS_SERV_TYPE_TMP_SEQ]`, please make sure the tables are in same schema.
	at org.apache.shardingsphere.sharding.route.engine.type.unconfigured.ShardingUnconfiguredTablesRoutingEngine.route(ShardingUnconfiguredTablesRoutingEngine.java:55)
	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:70)
	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:55)
	at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:59)
	at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:57)
	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:52)
	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:266)
	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:198)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
	at com.sun.proxy.$Proxy35.execute(Unknown Source)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:62)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:78)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
	at org.apache.ibatis.executor.keygen.SelectKeyGenerator.processGeneratedKeys(SelectKeyGenerator.java:68)
	... 21 more
</code></pre></div>