ResultSet and aggregation

Posted by kachanov on Stack Overflow See other posts from Stack Overflow or by kachanov
Published on 2010-04-01T13:49:50Z Indexed on 2010/04/01 13:53 UTC
Read the original article Hit count: 261

Filed under:
|
|
|
|

Ok, I admit my situation is special

There is a data system that supports SQL-92 and JDBC interface

However the SQL requets are pretty expensive, and in my application I need to retreive the same data multiple times and aggregate it ("group by") on different fields to show different dimensions of the same data.

For example on one screen I have three tables that show the same set or records but aggregated by City (1st grid), by Population (2nd grid), by number of babies (3rd grid)

This amounts to 3 SQL queries (which is very slow), UNLESS anyone of you can suggest any idea any library from apache commons or from google code, so that I can select all records into ResultSet and get 3 arrays of data group by different fields from this single ResultSet.

Am I'm missing some obvious and unexpected solution to this problem?

© Stack Overflow or respective owner

Related posts about java

Related posts about resultset