Efficient way to go over result set in Java

前端 未结 4 1445
我寻月下人不归
我寻月下人不归 2021-01-19 10:54

I am running a select command which returns 1,000,000 rows iterating over the ResultSet. The below code takes 5 minutes to execute.

Is there a faster way of iteratin

4条回答
  •  被撕碎了的回忆
    2021-01-19 11:27

    Make sure you're using pooled connections.

    Using PreparedStatements could also have a possitive effect on performance.

    (Though that probably won't save you several minutes.)

    What are you doing with the data? Do you really need to load all that data at once?

提交回复
热议问题