Fair enough. What you're trying to do may best be done off the db server. I only point it out because we had a similar problem about a year ago in a previous job where another team was trying to do a lot of data manipulation in C#: pulling the data out of postgres, performing analysis, and then pushing the results back to postgres. It was taking 25+ hours to handle 24 hours of data, and the team working on it just couldn't optimise it sufficiently. When I and my teammate were tapped to look at the problem, the first thing we each said was "stored procedure". Once we had written that, it dropped to about 1 hour to handle 24 hours of data, so I thought I should at least propose it on this thread.

It used less CPU and memory on the DB server, too, because it didn't have to serialise all that data. You might be surprised at how much less load it actually takes on the server. If you were to make your API calls, throw them into a temp table, and then use a stored procedure to injest it to the correct tables, it may actually do better than you expect. Or maybe not - there's definitely not enough information here to tell, but sometimes it takes a total algorithmic change to effect the performance gains you need, when simple tweaks are insufficient.


In reply to Re^6: Too Many IDs by Tanktalus
in thread Too Many IDs by The_Dj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.