{"id":248,"date":"2010-01-16T10:20:18","date_gmt":"2010-01-16T10:20:18","guid":{"rendered":"https:\/\/kari.world.ikari.fi\/2010\/01\/16\/reducing-memory-usage\/"},"modified":"2010-01-16T10:20:18","modified_gmt":"2010-01-16T10:20:18","slug":"reducing-memory-usage","status":"publish","type":"post","link":"https:\/\/kari.world.ikari.fi\/?p=248","title":{"rendered":"Reducing memory usage"},"content":{"rendered":"<p><a href=\"http:\/\/www.postgresql.org\/docs\/7.4\/static\/jdbc-query.html\">Example 31-2. Setting fetch size to turn cursors on and off.<\/a><br \/>\n<a href=\"http:\/\/abhirama.wordpress.com\/2009\/01\/07\/postgresql-jdbc-and-large-result-sets\/\">PostgreSql, JDBC and large result sets<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/827110\/large-resultset-on-postgresql-query\">Large ResultSet on postgresql query<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/1729781\/is-jdbc-a-big-memory-hog\">Is JDBC a big memory hog?<\/a><\/p>\n<p>Setting some reasonable fetch size might be meaningfull when working with results sets consisting from thousands of elements. Appearent difference is that with default fetch size, all data from DB are transferred (and stored until ResultSet is disposed) in JVM memory, but with fetch size only sub-set is needed to kept in memory at once.<\/p>\n<p>Update: <strong>18.1.1020<\/strong><br \/>\n<a href=\"http:\/\/etutorials.org\/Programming\/Java+performance+tuning\/Chapter+16.+Tuning+JDBC\/16.2+Tuning+JDBC\/\">Chapter: 16.2 Tuning JDBC<\/a><\/p>\n<p>Update: <strong>19.1.2010<\/strong><br \/>\nBatch update sounds interesting performance optimization possibility.<br \/>\n<a href=\"http:\/\/freeyourtech.wordpress.com\/2008\/07\/15\/using-postgresql-jdbc-for-bulk-updates-batch-size-vs-performance\/\">Using Postgresql JDBC for bulk updates \u2013 batch size vs performance<\/a><br \/>\n<a href=\"http:\/\/www.precisejava.com\/javaperf\/j2ee\/JDBC.htm\">Best practices to improve performance in JDBC<\/a><br \/>\n<a href=\"http:\/\/jdbc.postgresql.org\/documentation\/83\/server-prepare.html\">Server Prepared Statements<\/a> (Some discussion of <a href=\"http:\/\/groups.google.com\/group\/pgsql.interfaces.jdbc\/browse_thread\/thread\/50b11621d4d0c9ad?pli=1\">caveat emptors<\/a> and <a href=\"http:\/\/www.depesz.com\/index.php\/2008\/05\/10\/prepared-statements-gotcha\/\">Prepared statements gotcha<\/a> and <a href=\"http:\/\/www.postgresql.org\/docs\/8.3\/static\/protocol-flow.html\">45.2.3. Extended Query &#8211; BIND<\/a>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Example 31-2. Setting fetch size to turn cursors on and off. PostgreSql, JDBC and large result sets Large ResultSet on postgresql query Is JDBC a big memory hog? Setting some reasonable fetch size might be meaningfull when working with results sets consisting from thousands of elements. Appearent difference is that with default fetch size, all&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-248","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=248"}],"version-history":[{"count":0,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/248\/revisions"}],"wp:attachment":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}