I am making a change to a current program that gets payroll information being requested. I need to add quarter to date miles to this payroll request, but am having a hard time deciding what the best approach will be.
1) Call a method that runs a query 4 times for each quarter?
2) Call a method that runs a query once for all year, then sort through the query results to separate the quarters?
Is there a easy answer to this? If not, is there a way I can find out which one will perform the best? Time is an issue here, so I need the faster of the two ways. I have wrote the code to do option 1 and it is not too bad time wise, but could take up to 1 second per query, which is border line too long to tie up my application that is calling this method. Being new to Java I am not sure if there is a easy way to test the speed of this, or if it is just an easy answer that sorting query results is faster then running a query 4 times???
I would say that there is about 150 - 200 records for each quarter that it would have to sum up for each query..
1) Call a method that runs a query 4 times for each quarter?
2) Call a method that runs a query once for all year, then sort through the query results to separate the quarters?
Is there a easy answer to this? If not, is there a way I can find out which one will perform the best? Time is an issue here, so I need the faster of the two ways. I have wrote the code to do option 1 and it is not too bad time wise, but could take up to 1 second per query, which is border line too long to tie up my application that is calling this method. Being new to Java I am not sure if there is a easy way to test the speed of this, or if it is just an easy answer that sorting query results is faster then running a query 4 times???
I would say that there is about 150 - 200 records for each quarter that it would have to sum up for each query..