There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Paul Clapham wrote:Well, he IS using a StringBuilder to construct the big-ass query, so we don't have the dreaded String concatenation problem to deal with. But everything else you said about inserting into the output database one record at a time in batches... +1 to that.
I would have tried to use an "INSERT INTO... FROM SELECT ..." statement, or something like that, so that my code didn't even have to handle the data at all. But perhaps FoxPro doesn't support that kind of query, or perhaps it would have been an unmaintainable mess if it could even be written at all.
How big is your days loop? Also how many records returned from your localTemplate?
Generally speaking making one big ass query (yes big ass query is the technical term) for inserting lot of rows into a database is not reccomended.
c) You will send this big ass query to the database, which will need to parse it and the execute it.
http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
Paul Clapham wrote:Normally when you have CPU-bound code (which I guess is what you have there), you want it to use as much CPU as possible so that it can
finish sooner. But perhaps you have a dual-core machine, which would explain why it's only using 50% of the CPU. You would have to use more
than one thread if you wanted to use both cores for that computation.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Don't get me started about those stupid light bulbs. |