I am currently working on bringing out some nice plots.To be pricise, i am using jfreechart .The user can input from and to dates and that could be even as long as one year or sometimes even 2. In such cases i will have to work with data of the order of (40,000 * 12) rows from the database say for one year..and each row will contain 5 columns..Column 1 is TimeStamp and rest are floats... In such cases what is the best possible way to go about..I first tried taking the whole data in a resultset.Then i realised that accessing such huge ResultSet object thro rs.get() becomes slow.Then i tried first getting the whole data in resultset and then dumbing it into a 2D array.This made things faster to some extend..But i am confused ? is this the right way? or is there another better way of doing this?
Do you really need all the 40,000 * 12 = 480,000 records to create your chart? Think about what data is really needed to create the output you need, and find out an SQL statement that fetches only the data you need.