Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Alternative for multiple while loops to improve performance

by learnedbyerror (Monk)
on Dec 19, 2018 at 12:43 UTC ( #1227459=note: print w/replies, xml ) Need Help??


in reply to Alternative for multiple while loops to improve performance

I agree with the previous commenters regarding making sure that you have an optimized database. Correct indices are critical

Since you haven't provided any perl code, we can't give you very much advice. What I can offer, is that I often read data from a database and load it into a perl HashRef that is shaped in a way to allow me to access the data very directly for my purpose. This assumes that the data can fit within memory. See perlref and perlreftut for information on references if you are not familiar with them.

Cheers, lbe

  • Comment on Re: Alternative for multiple while loops to improve performance

Replies are listed 'Best First'.
Re^2: Alternative for multiple while loops to improve performance
by afoken (Canon) on Dec 19, 2018 at 19:25 UTC
    I often read data from a database and load it into a perl HashRef that is shaped in a way to allow me to access the data very directly for my purpose. This assumes that the data can fit within memory.

    Depending on your data, this can be a huge waste of resources. As a general rule of thumb, try not to fetch more data than you really need from the database, and let the database sort, filter, and aggregate the data as much as possible.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1227459]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2019-07-19 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?