Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^2: A database table size issue

by nikosv (Chaplain)
on Apr 27, 2012 at 14:54 UTC ( #967660=note: print w/replies, xml ) Need Help??

in reply to Re: A database table size issue
in thread A database table size issue

++ for the good answer but just to add to it, use set based logic rather than procedural row by row processing;Use the server resources rather that the client's. Furthermore even opening just firehose cursors for fetching that amount of rows will place loads of stress over the connection line if not optimised for batch fetching

Replies are listed 'Best First'.
Re^3: A database table size issue
by JavaFan (Canon) on Apr 29, 2012 at 22:34 UTC
    Use the server resources rather that the client's.
    Really? Why? Typically, the number of servers is far less than the number of clients. Using server resources that benefit one client hurt all the clients.

    I'm not saying that in this case the task should be done on the client (we've no idea about the task, nor about the setup), but I disagree with the blanket "use server resources rather than the clients". In way too many cases that isn't scalable to do without thinking.

      I set to write about why you should be using the dbms's power or resources instead of the client's,mainly because of query optimization,execution plan caching,parallel query execution,set based operations instead of procedural row by row,etc, but then I've noticed the OP's remark Re^2: A database table size issue,which acts as straightforward reply to your question :

      Thanks for the suggestion. The script was really slow when I processed the table row by row. I took your advice and rewrote the SQL to let the DB to handle part of the processing. The script now runs much faster than before

      So I have no futher comments
        So I have no futher comments
        That's fine, and I already acknowledged that the OPs situation might very well call for processing on the server side.

        That does not mean I agree with the blanket statement -- just because it's the right idea sometimes, 50% of the time, or even 90% of the time, it doesn't mean it's the right thing to do all the time.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967660]
and !@monks...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2018-06-24 07:54 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.