I will attempt running the command via ODBC directly, with the FETCH syntax, and produce a heap histogram (is there anything in particular you are looking for or a specific tool output -- I generally use jprofiler).
This sounds like a great next step, please let us know what you find. As another useful step, you could run that command using the Derby "ij" tool, and set derby.language.logQueryPlan=true, and then post the query plan information from your derby.log. thanks, bryan