Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by SimonClinch (Chaplain)
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2016-05-25 01:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?