Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: perl & SQL best practices

by doom (Deacon)
on Apr 30, 2012 at 18:57 UTC ( #968130=note: print w/ replies, xml ) Need Help??


in reply to Re^2: perl & SQL best practices
in thread perl & SQL best practices

Joins are costly, and considering there typically are more clients than servers, there are a lot of situations were it makes sense to do the join on the client -- there's a lot more client CPU available than server CPU.
Try another rule of thumb: the network is slow. Moving more data from server to client than you need to is rarely a good idea. First guess-- albeit not the last word-- is to use the features built into the database to crunch the data.

And if a database join seems "expensive" to you, I suggest you need to look at your indexes.


Comment on Re^3: perl & SQL best practices
Re^4: perl & SQL best practices
by JavaFan (Canon) on Apr 30, 2012 at 19:44 UTC
    Try another rule of thumb: the network is slow. Moving more data from server to client than you need to is rarely a good idea. First guess-- albeit not the last word-- is to use the features built into the database to crunch the data.
    I will repeat myself, but I fear I might as well talk to the walls: it all depends. Measure, and you will know. Don't assume the network is slow -- and that hence you should overload your database server as much as possible. Slowing everyone else down, so your query gets done "at the server" may not the best solution.

    Measure. Don't assume.

    Measure. Don't assume.

    And once you have implemented a solution because it's the best today, measure the next day again and the day after, and keep repeating it, because circumstances change.

      That's right, you've got to measure everything, everything! When I design a system I always write the code every possible way and then benchmark each of them against each other before roll-out.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-08-30 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls