Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to increase the efficiency of the code wen working with DB?

by SimonClinch (Deacon)
on May 26, 2011 at 13:07 UTC ( #906828=note: print w/replies, xml ) Need Help??


in reply to How to increase the efficiency of the code wen working with DB?

My first reaction is try with GROUP BY instead of DISTINCT - it gives many RDBMSs the chance to use a faster internal algorithm. Also it doesn't look so much like you're doing it on the face of it, but just in case: avoid reconnecting to the database between queries - maintain a single DBI database handle unless you are doing parallel processing. Consider using multiple database handles and forks (updated and see also Parallel::ForkManager) if the opportunity for parallel processing exists to save elapsed time, especially if there are many such iterations to parallelise.

One world, one people

  • Comment on Re: How to increase the efficiency of the code wen working with DB?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://906828]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2016-12-10 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (163 votes). Check out past polls.