Large ResultSet on postgresql query

Posted by tuler on Stack Overflow See other posts from Stack Overflow or by tuler
Published on 2009-05-05T21:59:37Z Indexed on 2010/12/23 15:54 UTC
Read the original article Hit count: 270

Filed under:
|
|
|
|

I'm running a query against a table in a postgresql database. The database is on a remote machine. The table has around 30 sub-tables using postgresql partitioning capability.

The query will return a large result set, something around 1.8 million rows.

In my code I use spring jdbc support, method JdbcTemplate.query, but my RowCallbackHandler is not being called.

My best guess is that the postgresql jdbc driver (I use version 8.3-603.jdbc4) is accumulating the result in memory before calling my code. I thought the fetchSize configuration could control this, but I tried it and nothing changes. I did this as postgresql manual recomended.

This query worked fine when I used Oracle XE. But I'm trying to migrate to postgresql because of the partitioning feature, which is not available in Oracle XE.

My environment:

  • Postgresql 8.3
  • Windows Server 2008 Enterprise 64-bit
  • JRE 1.6 64-bit
  • Spring 2.5.6
  • Postgresql JDBC Driver 8.3-603

© Stack Overflow or respective owner

Related posts about java

Related posts about spring