Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql mybatis selectMap性能_Sql_Mybatis - Fatal编程技术网

Sql mybatis selectMap性能

Sql mybatis selectMap性能,sql,mybatis,Sql,Mybatis,mysql表中有100万个条目[name VARCHAR,id bigint20,category int11] 我在mybatis SELECT xml中使用以下SELECT SQL <select id="getIdNameMap" parameterType="String" resultType="java.util.HashMap"> select NAME , ID from PRODUCTS where CATEGORY = #{value} </sele

mysql表中有100万个条目[name VARCHAR,id bigint20,category int11]

我在mybatis SELECT xml中使用以下SELECT SQL

<select id="getIdNameMap" parameterType="String" resultType="java.util.HashMap">
    select NAME , ID from PRODUCTS where CATEGORY = #{value}
</select>
我使用以下java代码

Reader Reader=Resources.getResourceAsReaderSQL\u映射\u配置\u文件\u路径

sqlMapClient=新建SqlSessionFactoryBuilder.buildreader

SqlSession SqlSession=sqlMapClient.opensessionrue

Map kvpList=sqlSession.selectMapgetIdNameMap,1,NAME

将数据拉入地图需要6902秒

使用下面的代码,将相同的数据拉入地图需要2368秒

ResultSet rs=sqlSession.getConnection.createStatement.executeQueryselect名称,ID来自类别为1的产品

而rs.next{

map.putrs.getString1,Long.parseLongers.getString2

}

System.out.printlnmap.size

rs.close


有什么建议吗?

我正在CentOS 5.8版上使用mybatis-3.2.0,为什么不在mybatis中使用相同的查询?